Sway: [enhancement] Add mouse sensitivity setting

Created on 23 Nov 2018  路  11Comments  路  Source: swaywm/sway

This is a very similar issue to #3004.

Right now we have the ability to enable and disable mouse acceleration, but no setting for mouse sensitivity. Sensitivity in sway is lower than in my other distros/OSes, and it's been bugging me.

Depending on my schedule I might give it a try this week-end. Considering how similar the code will be to #3004, this should not be very hard to implement, unless there is something I'm overlooking.

enhancement

Most helpful comment

Is there a way now to change the mouse sensitivity in sway?

All 11 comments

Wouldn't that be possible already by setting the "flat" acceleration profile and then setting a factor between -1 and 1? Or the calibration matrix may be another alternative.

@progandy Mhhh, that might be it yeah. This libinput docs paragraph seems to indicate that you can indeed keep a 1:1 ratio and have a factor. Now, whether that factor is wide enough is another question. I'm not on my machine right now, I'll test that later .
Moreover, my initial issue with inconsistent default sens (read: DPI settings) might be something in udev unrelated to sway.
I'll check back soon, thanks.

I found this.

TL;DR: 0 is the default, -1 is the minimum possible speed, and 1 is the maximum possible speed.

One thing that confuses me is how can there be a maximum and minimum speed? Does libinput perhaps pass this number to the device itself? In any case, it works well enough for me, but higher limits would be nice.

Is there a way now to change the mouse sensitivity in sway?

I'm also interested if this is planned.

to change sensitivity, add to sway config:

input <your device identifier> {
    accel_profile <flat or adaptive>
    pointer_accel <between -1.0 and 1.0>
}

as identifier you can use type:pointer, type:touchpad or use swaymsg -t get_inputs to find your input device

For me, pointer_accel 1 is still too slow for me. Therefore I tried to influence the pointer's transformation matrix by setting calibration_matrix 2 0 0 0 2 0. But I didn't notice any difference...is there any solution to this?

The workaround proposed is not enough, because some may want to keep the adaptive behaviour and still alter the overall pointer speed factor.

I have a suggestion for making the configuration syntax for this feature more intuitive.

# this is a little redundant if one would set the sensitivity setting to zero, it might just be easier to have this anyway for convenience'
input <identifier> adaptive true|false

# describes the slope of the sensitivity/raw_pointer_speed curve
# sensitivity would be on the y axis while pointer input speed is on the x axis                               
# a value of 0 would have the same effect as "adaptive false"
input <identifier> sensitivity [-x..x] 
# alternative names could be "adaptive_sensitivity" or "sensitivity_curve/ramp"

# multiplies the distance traveled (per frame) by this factor
# a negative setting would make the cursor move in the opposite direction
input <identifier> speed [-x..x]

Also there is a video that shows a good example of how an acceleration curve could be customized and what the benefits might be:
(https://youtu.be/SBXv0xi-wyQ?t=230)

Just a note, and possibly the solution to some of your issues:

Despite swaymsg -t get_inputs printing the identifier with escaped characters like so:

"identifier": "2:10:TPPS\/2_Elan_TrackPoint",

Make sure that when you add it to your configuration, you remove the escapes:

input "2:10:TPPS/2_Elan_TrackPoint" {
    accel_profile "flat"
    pointer_accel -0.3
}

Also, another note, if you specify the same input device twice ( for example ), the second setting will override the first setting and set it back to default:

input "2:10:TPPS/2_Elan_TrackPoint" accel_profile "flat"
input "2:10:TPPS/2_Elan_TrackPoint" pointer_accel -0.3

This will set accel_profile back to adaptive and then the pointer_accel to -0.3

Forgot to add: So specify multiple settings the way I showed above with:

input [device] {
    option val
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

emersion picture emersion  路  4Comments

ddevault picture ddevault  路  4Comments

emersion picture emersion  路  4Comments

Alphare picture Alphare  路  3Comments

dnkl picture dnkl  路  4Comments