6

I am running Ubuntu 18.04.2 LTS with the standard gdm3 display manager. I would need to adjust the mouse speed, which I can do with xinput, using the following two commands in my case:

xinput set-prop 9 287 0, 1
xinput set-prop 9 284 -0.9

The only problem is that I can't make these settings permanent after reboot. If I place them into ~/.bashrc, then they do work fine after opening a new terminal window, but I would like to achieve the same already when the desktop has started (preferable already being active at the long-in screen).

Following this thread I did try to add these commands into ~/.xsessionrc, but also to several other different locations, like: /etc/profiles, ~/.xinputrc, /etc/X11/xinit/xinitrc, or /etc/X11/xinit/xinputrc, but none of them had effect after xwindows was up.

Any suggestions directing me to the correct path would be highly appreciated!

xinput details: (unfortunately there are multiple ids with the same name "Razer Razer DeathAdder Elite", hence I have to use the id number = 9):

⎡ 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              id=10   [slave  pointer  (2)]
⎜   ↳ Razer Razer Ornata Chroma                 id=13   [slave  pointer  (2)]
⎜   ↳ Razer Razer Ornata Chroma                 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)]
    ↳ Power Button                              id=7    [slave  keyboard (3)]
    ↳ HD Webcam C525                            id=8    [slave  keyboard (3)]
    ↳ Razer Razer DeathAdder Elite              id=11   [slave  keyboard (3)]
    ↳ Razer Razer Ornata Chroma                 id=12   [slave  keyboard (3)]
    ↳ Razer Razer DeathAdder Elite              id=15   [slave  keyboard (3)]
    ↳ Razer Razer Ornata Chroma                 id=16   [slave  keyboard (3)]

xinput list-props 9 output, highlighting the two relevant ones:

    ...
    libinput Accel Speed (284):   -0.900000
    libinput Accel Speed Default (285): 0.000000
    libinput Accel Profiles Available (286):    1, 1
    libinput Accel Profile Enabled (287): 0, 1
    libinput Accel Profile Enabled Default (288):   1, 0
    ...

2
  • 1
    You can set it using Options in a file in /usr/share/X11/xorg.conf.d.
    – Pilot6
    Feb 24, 2019 at 11:28
  • Thanks @Pilot6! I am trying to google around how to do that, but was unable to find good references. I am adding the xinput info into the original quesiton, could you please help translating device=9 and properties 287 & 284 into xorg.conf.d Option entries?
    – Zorgmorduk
    Feb 24, 2019 at 12:53

3 Answers 3

5

Option 1:

Edit /usr/share/X11/xorg.conf.d/40-libinput.conf

And add there 2 lines to the first section before EndSection:

Option "AccelProfile" "flat"
Option "AccelSpeed" "-0.9"

Like this

Section "InputClass"
    Identifier "libinput pointer catchall"
    MatchIsPointer "on"
    MatchDevicePath "/dev/input/event*"
    Driver "libinput"
    Option "AccelProfile" "flat"
    Option "AccelSpeed" "-0.9"
 EndSection

Option 2:

Use evdev instead of libinput.

Option 3:

Add the 2 commands into "Startup Applications"

10
  • Thanks! In my case the file is: /usr/share/X11/xorg.conf.d/40-libinput.conf, and have added the two Option lines exactly as you indicated. Unfortunately it does not have effect, and the settings are on their default after restart. I am trying now to add the same to /etc/... and report back.
    – Zorgmorduk
    Feb 24, 2019 at 13:23
  • It should work in this file.
    – Pilot6
    Feb 24, 2019 at 13:24
  • Try to add to other sections. Is it a mouse or touchpad?
    – Pilot6
    Feb 24, 2019 at 13:25
  • It is a mouse. Unforunately it does not work. I've also tried to put into the end of /etc/X11/xorg.conf, but does not help neither. I have generated the xorg.conf file as suggested here: askubuntu.com/questions/4662/… .But will remove this now.
    – Zorgmorduk
    Feb 24, 2019 at 13:29
  • In Ubuntu it's /usr/share/X11
    – Pilot6
    Feb 24, 2019 at 13:39
3

Answer:

  • Hit the "Windows" key
  • Type "Start" and click the "Startup Applications Preferences" icon.
  • In the "Startup Applications Preferences" window, click the "Add" button.
  • Enter a "Name" in the name field
  • Enter "xinput set-prop 9 287 0, 1" in the "Command" field
  • Give it a brief description in the "Description" field
  • Click "Add"
  • Repeat the above five (5) steps for the other command.
  • Alternatively, chain both commands into "xinput set-prop 9 287 0, 1 && xinput set-prop 9 284 -0.9" and enter that in the "Command" field.

I've found this approach both clean and effective for my touchpad, and it should work for the mouse as well. Best of luck.

2
  • Thank you. By far the cleanest solution. I have ended up here after a wild goose chase trying to create startup scripts, edit various files deep within the OS, etc all to no avail. This works flawlessly on Pop!_OS 22.04
    – Inigo
    Oct 1, 2022 at 19:59
  • This was the only solution I could get to work on Manjaro after much struggling with other suggestions. Quick and easy.
    – Dan
    Oct 6, 2022 at 23:47
1

Option 1 persisted for me after reboot because I edited as the owner (root) and all is well with my ''Primax Kensington Eagle Trackball'

Ubuntu 18.04 upgraded to 20.04 converted to Xubuntu here (not that it should matter but it never hurts to be specific).

/usr/ is owned by root but can be viewed by other gedit users without ability to save changes. If in doubt as to who can edit what review file permissions.

1
  • 2
    Your post does not provide a whole and complete answer to the question. Please refrain from providing answers such as, "me too," or, "I did this from another answer and it worked for me."
    – Damian T.
    Feb 1, 2022 at 20:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.