How to change default Xinput values?
I want to disable mouse acceleration on my mouse, and would like to change it by changing the value of libinput Accel Profile Enabled Default
from 1, 0
to 0, 1
with a command xinput --set-prop [ID] [id of the value] 0, 1
but that returns an error:
X Error of failed request: BadAccess (attempt to access private resource denied)
Major opcode of failed request: 131 (XInputExtension)
Minor opcode of failed request: 57 ()
Serial number of failed request: 19
Current serial number in output stream: 20
I can't create a startup application because my mouse's ID changes constantly for no reason. I also cannot change the global value of the variable because I need to have Pointer Acceleration on for my touchpad.
Edited:
I edit my answer to show a so much simpler aproach. You can use a device type:name
instead of its ID
like so:
xinput set-prop "keyboard:Logitech K400 Plus" "libinput Middle Emulation Enabled" 1
This avoids having to know the volatile ID
field.
Old answer:
I had not found a way of changing Default values of Xinput, but you can use bash pipes to get the ID dynamically and use it in a Startup Aplication.
As I lack the specifics of your device, I exemplify with my personal case. I want to change some Xinput properties of my K400+ keyboard.
First you have to locate univocally the Xinput line that identifies your device.
$ xinput
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ Logitech K400 Plus id=6 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Logitech K400 Plus id=7 [slave keyboard (3)]
So I can use the simple regex K400.*keyboard
to get the last line
(not the pointer one). Next I grep
this regex into a pipe, isolate
the id via cut
utility.
$ xinput | grep K400.*keyboard | cut -f2 | cut -c4-
7
Finnaly I use it to change whatever property I want. In this case, I'm
interested in libinput Middle Emulation Enabled
. The full command
that does this is:
xinput | grep K400.*keyboard | cut -f2 | cut -c4- |
xargs -I{} xinput set-prop {} "libinput Middle Emulation Enabled" 1
Now you can use it as a Startup Aplication.