Make xinput settings permanent after boot

5,260

Solution 1

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"

Solution 2

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.

Share:
5,260

Related videos on Youtube

Zorgmorduk
Author by

Zorgmorduk

Updated on September 18, 2022

Comments

  • Zorgmorduk
    Zorgmorduk over 1 year

    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
        ...
    
    • Pilot6
      Pilot6 about 5 years
      You can set it using Options in a file in /usr/share/X11/xorg.conf.d.
    • Zorgmorduk
      Zorgmorduk about 5 years
      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
    Zorgmorduk about 5 years
    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.
  • Pilot6
    Pilot6 about 5 years
    It should work in this file.
  • Pilot6
    Pilot6 about 5 years
    Try to add to other sections. Is it a mouse or touchpad?
  • Zorgmorduk
    Zorgmorduk about 5 years
    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.
  • Pilot6
    Pilot6 about 5 years
    In Ubuntu it's /usr/share/X11
  • Zorgmorduk
    Zorgmorduk about 5 years
    OK, I have removed the etc/X11/xorg.conf entirely, and have only the /usr/share/X11/xorg.conf.d/40-libinput.conf file in place with the discussed additional two options. Just to report back: I tried adding to the touchpad section as well, no difference, but ultimately this should be a mouse/pointer. It looks like as if something overwrites after this is read.
  • Pilot6
    Pilot6 about 5 years
    Another way is ti switch mouse to evdev instead of libinput.
  • Pilot6
    Pilot6 about 5 years
    A third way is to add a script with 2 commands to "Startup Applications" that should work.
  • Zorgmorduk
    Zorgmorduk about 5 years
    Thanks for your support @Pilot6! I think I will remain at workaround 3, and adding them to "Startup Applications". It does work indeed, however only after the user logged in. Unfortunately the mouse without these settings is extremely quick, so it's hard to click even on the user to log in, but keyboard is a good compromise, and afterwards everything works fine.
  • hurelhuyag
    hurelhuyag over 4 years
    First option very promising but didn't work on my touchpad's tap to click. Startup applications is easy solution but works only single account
  • Damian T.
    Damian T. about 2 years
    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."