Saving mouse speed

Hello
I’ve tried to lower the mouse speed from: preferences/keyboard and mouse
Im not even sure that app is working. Anyway with the lowest mouse speed setting, its still too high.
So, im using this command line to adjust my mouse speed.
However, this setting doesnt get saved and i have to redo at every launch.
Where can i save that command line? Any cong file that i could save that setting into?
And should i add those lines? If not what should i add?
#reduce mouse acceleration
xinput --set-prop 9 “libinput Accel Speed” -1 &
Thanks!

The manual describes how to add an entry to your autostart.

Might want to get the ID programmatically since they aren’t enumerated in a predictable manner. Something like xinput --set-prop $(xinput --list --id-only "device") "libinput Accel Speed" -1 where device is the listed name of your device according to xinput --list.

Upstream may have a fix for this that might hit 19.10.

1 Like

Hello wxl
I build house for living so im clueless
I’ve tried a few thing
At add i adeed: I changed the line at every reboot
xinput --set-prop 9 “libinput Accel Speed” -1
xinput --set-prop $(xinput --list --id-only “9”) “libinput Accel Speed” -1
xinput --set-prop $(xinput --list --id-only 9) “libinput Accel Speed” -1
xinput --set-prop 9(xinput --list --id-only 9) “libinput Accel Speed” -1
Nothing is working, mouse get reset at every reboot

This doesnt mean nothing to me

There’s no guarantee that the system will assign the number 9 to your device every time. The part inside the parenthesis should return the ID assuming you use the natural language way of describing the device. Put another way, the ID of your device might change, but the name never will. This method ensures you always use the right ID. If you don’t, it won’t work.

Again, run xinput list. What’s the name of your device? Put that where I had “device” above. Make sure it works correctly on the command line before adding it to autostart.

1 Like

Hi
I tried that in terminal. I changed the value to notice if the mouse speed changed. It doesnt work. May be i did something wrong?
xinput --set-prop $(xinput --list --id-only Razer Razer DeathAdder Elite) “libinput Accel Speed” -0.5

~$ xinput list
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ Razer Razer DeathAdder Elite id=9 [slave pointer (2)]
⎜ ↳ Razer Razer DeathAdder Elite Consumer Control id=11 [slave pointer (2)]
⎜ ↳ Logitech K400 Plus id=14 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
↳ Video Bus id=7 [slave keyboard (3)]
↳ Power Button id=8 [slave keyboard (3)]
↳ Razer Razer DeathAdder Elite Keyboard id=10 [slave keyboard (3)]
↳ Razer Razer DeathAdder Elite System Control id=12 [slave keyboard (3)]
↳ Razer Razer DeathAdder Elite id=13 [slave keyboard (3)]
↳ Razer Razer DeathAdder Elite Consumer Control id=15 [slave keyboard (3)]
↳ Logitech K400 Plus id=16 [slave keyboard (3)]

Remember, I used quotes around the name of the device. Spaces generally separate arguments, so whereas the command only expects one argument, “device,” you give it four.

Thinking about math, imagine 𝑓(𝑥)=𝑥. We could write this in pseudocode as

f(x):
   return x

Another function might be 𝑔(𝑎,𝑏,𝑥,𝑧)=𝑎+𝑏+𝑥+𝑧 which would could represent as

g(a, b, x, z):
    return a + b + x + z

So when we run f(1), we get back 1 and when we run g(1, 2, 3, 4), we get back 10. However, the behavior of the function is undefined if we do something like f(1, 2, 3, 4), which is to say it breaks.

That’s what you’re trying to do.

Instead of:

xinput --set-prop $(xinput --list --id-only Razer Razer DeathAdder Elite) “libinput Accel Speed” -0.5

do:

xinput --set-prop $(xinput --list --id-only "Razer Razer DeathAdder Elite") “libinput Accel Speed” -0.5
1 Like

Did not work and heres the output

op:~$ xinput --set-prop $(xinput --list --id-only “Razer Razer DeathAdder Elite”) “libinput Accel Speed” -0.5
Warning: There are multiple devices matching ‘Razer Razer DeathAdder Elite’.
To ensure the correct one is selected, please use the device ID, or prefix the
device name with ‘pointer:’ or ‘keyboard:’ as appropriate.

unable to find device Razer Razer DeathAdder Elite
unable to find device “libinput

says enable to find device “libinput
But “libinput is installed

top:~$ libinput
Usage: libinput [–help|–version] []

Global options:
–help … show this help and exit
–version … show version information and exit

Commands:
list-devices
List all devices with their default configuration options

debug-events
Print events to stdout

debug-gui
Display a simple GUI to visualize libinput’s events.

measure
Measure various device properties. See the man page for more info

Ok, your device is a pain because it’s listed in multiple types (keyboard, pointer) and since the device name search is based on substrings, i.e. if we were trying to affect “Razer Razer DeathAdder Elite Consumer Control,” it would be no problem but since “Razer Razer DeathAdder Elite” is a substring of that and all the other names, it’s ambiguous.

So the way to get the id is going to be more complicated. We’re going to get a list of all of your devices and then trim it down to the ones that match, and then use the fact that the pointers always seem to be listed before the keyboards to pick the right one:

xinput list | \
    # trim the list to just those that match
    grep "Razer Razer DeathAdder Elite[[:space:]]*id" | \
    # pick the first value
    head -n1 | \
    # select text to the right of the equals sign
    awk -F= '{print $2}' | \
    # select text before the first space
    awk '{print $1}'

Now you just need to add that to the overall command:

xinput --set-prop $(xinput list | grep "Razer Razer DeathAdder Elite[[:space:]]*id" | head -n1 | awk -F= '{print $2}' | awk '{print $1}') "libinput Accel Speed" -0.5
1 Like

@wxl
what the option to paste some code in the forum correctly?

```
put some code here
and here
and here
```

Or `some code here` (inline, shouldn’t have multiple lines)

1 Like

danrobi@danrobi-desktop:~$ xinput list | \

grep “Razer Razer DeathAdder Elite id” |
tail -n1 |
awk -F= ‘{print $2}’ |
awk ‘{print $1}’
danrobi@danrobi-desktop:~$ xinput --set-prop $(xinput list | grep “Razer Razer DeathAdder Elite id” | tail -n1 | awk -F= ‘{print $2}’ | awk ‘{print $1}’) “libinput Accel Speed” -0.5
Usage: xinput set-prop [–type=atom|float|int] [–format=8|16|32] [ …]

The problem is using head not tail

1 Like
danrobi@danrobi-desktop:~$ xinput list | \
> grep "Razer Razer DeathAdder Elite id" | \
> tail -n1 | \
> awk -F= '{print $2}' | \
> awk '{print $1}'
danrobi@danrobi-desktop:~$ xinput --set-prop $(xinput list | grep "Razer Razer DeathAdder Elite id" | tail -n1 | awk -F= '{print $2}' | awk '{print $1}') "libinput Accel Speed" -0.5
Usage: xinput set-prop <device> [--type=atom|float|int] [--format=8|16|32] <property> <val> [<val> ...]
danrobi@danrobi-desktop:~$ xinput --set-prop $(xinput list | grep "Razer Razer DeathAdder Elite id" | tail -n1 | awk -F= '{print $2}' | awk '{print $1}') "libinput Accel Speed" -1
Usage: xinput set-prop <device> [--type=atom|float|int] [--format=8|16|32] <property> <val> [<val> ...]
danrobi@danrobi-desktop:~$ xinput --set-prop $(xinput list | grep "Razer Razer DeathAdder Elite id" | tail -n1 | awk -F= '{print $2}' | awk '{print $1}') "libinput Accel Speed" -2
Usage: xinput set-prop <device> [--type=atom|float|int] [--format=8|16|32] <property> <val> [<val> ...]
danrobi@danrobi-desktop:~$ xinput --set-prop $(xinput list | grep "Razer Razer DeathAdder Elite id" | tail -n1 | awk -F= '{print $2}' | awk '{print $1}') "libinput Accel Speed" -5
Usage: xinput set-prop <device> [--type=atom|float|int] [--format=8|16|32] <property> <val> [<val> ...]
danrobi@danrobi-desktop:~$ xinput --set-prop $(xinput list | grep "Razer Razer DeathAdder Elite id" | tail -n1 | awk -F= '{print $2}' | awk '{print $1}') "libinput Accel Speed" -0.1
Usage: xinput set-prop <device> [--type=atom|float|int] [--format=8|16|32] <property> <val> [<val> ...]
danrobi@danrobi-desktop:~$ xinput --set-prop $(xinput list | grep "Razer Razer DeathAdder Elite id" | tail -n1 | awk -F= '{print $2}' | awk '{print $1}') "libinput Accel Speed" -1
Usage: xinput set-prop <device> [--type=atom|float|int] [--format=8|16|32] <property> <val> [<val> ...]
danrobi@danrobi-desktop:~$ xinput --set-prop $(xinput list | grep "Razer Razer DeathAdder Elite id" | tail -n1 | awk -F= '{print $2}' | awk '{print $1}') "libinput Accel Speed" 1
Usage: xinput set-prop <device> [--type=atom|float|int] [--format=8|16|32] <property> <val> [<val> ...]
danrobi@danrobi-desktop:~$ xinput --set-prop 9 "libinput Accel Speed" 1
danrobi@danrobi-desktop:~$ xinput --set-prop $(xinput list | grep "Razer Razer DeathAdder Elite id" | tail -n1 | awk -F= '{print $2}' | awk '{print $1}') "libinput Accel Speed" -1
Usage: xinput set-prop <device> [--type=atom|float|int] [--format=8|16|32] <property> <val> [<val> ...]
danrobi@danrobi-desktop:~$ xinput --set-prop 9 "libinput Accel Speed" 1
danrobi@danrobi-desktop:~$ xinput --set-prop 9 "libinput Accel Speed" -1
danrobi@danrobi-desktop:~$ xinput list | \
> grep "Razer Razer DeathAdder Elite id" | \
> head -n1 | \
> awk -F= '{print $2}' | \
> awk '{print $1}'
danrobi@danrobi-desktop:~$ xinput --set-prop $(xinput list | grep "Razer Razer DeathAdder Elite id" | head -n1 | awk -F= '{print $2}' | awk '{print $1}') "libinput Accel Speed" -0.5
Usage: xinput set-prop <device> [--type=atom|float|int] [--format=8|16|32] <property> <val> [<val> ...]
danrobi@danrobi-desktop:~$ 

Thats everything i’ve tried so far, doesnt work. But thats still working: xinput --set-prop 9 “libinput Accel Speed” -1

You’re still using tail.

1 Like

no scroll down
thats the first time with tail but i did with head after

Ok, then let’s do this step by step:

xinput list | grep "Razer Razer DeathAdder Elite id"
xinput list | grep "Razer Razer DeathAdder Elite id" | head -n1
xinput list | grep "Razer Razer DeathAdder Elite id" | head -n1 | awk -F= '{print $2}'
xinput list | grep "Razer Razer DeathAdder Elite id" | head -n1 | awk -F= '{print $2}' | awk '{print $1}'
1 Like

Mouse speed did not change

danrobi@danrobi-desktop:~$ xinput list | grep "Razer Razer DeathAdder Elite id"
danrobi@danrobi-desktop:~$ xinput list | grep "Razer Razer DeathAdder Elite id" | head -n1
danrobi@danrobi-desktop:~$ xinput list | grep "Razer Razer DeathAdder Elite id" | head -n1 | awk -F= '{print $2}'
danrobi@danrobi-desktop:~$ xinput list | grep "Razer Razer DeathAdder Elite id" | head -n1 | awk -F= '{print $2}' | awk '{print $1}'
danrobi@danrobi-desktop:~$ xinput --set-prop $(xinput list | grep "Razer Razer DeathAdder Elite id" | tail -n1 | awk -F= '{print $2}' | awk '{print $1}') "libinput Accel Speed" -0.5
Usage: xinput set-prop <device> [--type=atom|float|int] [--format=8|16|32] <property> <val> [<val> ...]
danrobi@danrobi-desktop:~$ 

That makes no sense. That first command should simply run xinput list and return only the lines that include “Razer Razer DeathAdder Elite id” which should be

⎜ ↳ Razer Razer DeathAdder Elite id=9 [slave pointer (2)]
↳ Razer Razer DeathAdder Elite id=13 [slave keyboard (3)]

if you gave the right output for xinput list before.

1 Like

Im sorry did not noticed that i was still using tail “ite id” | tail -n1 | awk -F= ‘{print $2}’ | awk"

so i did it again

danrobi@danrobi-desktop:~$ xinput list | grep "Razer Razer DeathAdder Elite id"
danrobi@danrobi-desktop:~$ xinput list | grep "Razer Razer DeathAdder Elite id" | head -n1
danrobi@danrobi-desktop:~$ xinput list | grep "Razer Razer DeathAdder Elite id" | head -n1 | awk -F= '{print $2}'
danrobi@danrobi-desktop:~$ xinput list | grep "Razer Razer DeathAdder Elite id" | head -n1 | awk -F= '{print $2}' | awk '{print $1}'
danrobi@danrobi-desktop:~$ xinput --set-prop $(xinput list | grep "Razer Razer DeathAdder Elite id" | tail -n1 | awk -F= '{print $2}' | awk '{print $1}') "libinput Accel Speed" -0.5
Usage: xinput set-prop <device> [--type=atom|float|int] [--format=8|16|32] <property> <val> [<val> ...]
danrobi@danrobi-desktop:~$ xinput list | grep "Razer Razer DeathAdder Elite id"
danrobi@danrobi-desktop:~$ xinput list | grep "Razer Razer DeathAdder Elite id" | head -n1
danrobi@danrobi-desktop:~$ xinput list | grep "Razer Razer DeathAdder Elite id" | head -n1 | awk -F= '{print $2}'
danrobi@danrobi-desktop:~$ xinput list | grep "Razer Razer DeathAdder Elite id" | head -n1 | awk -F= '{print $2}' | awk '{print $1}'
danrobi@danrobi-desktop:~$ xinput --set-prop $(xinput list | grep "Razer Razer DeathAdder Elite id" | head -n1 | awk -F= '{print $2}' | awk '{print $1}') "libinput Accel Speed" -0.5
Usage: xinput set-prop <device> [--type=atom|float|int] [--format=8|16|32] <property> <val> [<val> ...]
danrobi@danrobi-desktop:~$ 

Still same result

What’s xinput list again?

1 Like