I successfully followed the answer to this question to set different sensitivities for my touchpad and my USB mouse. Only problem is, once you unplug and replug the device or shutdown, restart etc., the settings reset.

4 Answers 4


According to How to configure the TrackPoint (from ThinkWiki), the method for changing the settings on a per-user basis is by using the .xsessionrc file, simply put all your xinput commands into that file and you should have your settings on boot.

The settings should be remembered after you unplug and replug the same device. But if they're not then we have a bug to report. I looked into all the events that happen when input devices are detected and I don't mind telling you that it's a real mess. If you need to go to a plan B then try adding the options into x.conf.d as shown in the above website.

  • 3
    FWIW whenever I tweak my Synaptics touchpad settings with xinput, my tweaks are forgotten when I suspend and resume. Ubuntu 10.10. Commented Jan 6, 2011 at 20:22
  • That's a bug, please report it. Commented Jan 6, 2011 at 20:50
  • 3
    On linux mint the file name is .xinputrc . :-)
    – inf3rno
    Commented Aug 24, 2015 at 4:56
  • 2
    Not a solution for plugged device after boot.
    – FlogFR
    Commented Nov 5, 2016 at 7:49
  • 2
    "The settings should be remembered after you unplug and replug the same device." Do you have a reference for this?
    – Mikel
    Commented Apr 29, 2020 at 20:17

I know this is a bit old, but in Ubuntu 14.04 I couldn't find a .xsessionrc or x.conf.d file, so I had to use xinput from the terminal. This is how you do it:

  1. Check the name of your device:

    xinput list
  2. See available options for your device:

    xinput list-props "Your Device Name"
  3. Edit settings (to make settings consistent after reboot/shutdown just add this command to Startup Applications):

    xinput set-prop "Your Device Name" "Option Name" "Value"

    Here is an example command I used to activate locked drags in my touchpad:

    xinput set-prop "SynPS/2 Synaptics TouchPad" "Synaptics Locked Drags" 1

    To activate/change another option just look for it in your device available options and play with them until you get the desired result.

You now know which commands resolve your problems. They may be more than one. Your next job is to add these commands to 'Startup Applications'. To do so:

  1. Open 'Startup Applications'.

  2. Click 'Add' and in the command field paste the desired command. Click 'Add'. You have added the first command.

  3. Add the other commands too in similar fashion (if you have more than one command). You are done. Next time you restart your computer, Ubuntu will automatically run these commands which will fix your mouse issues.

  • 5
    You can just create the file in your home directory if it doesn't exist.
    – Ian Dunn
    Commented Apr 25, 2015 at 7:19
  • 2
    This looks like it will persist across a restart, but how about when the device is unplugged from USB and plugged back in (no restart involved)? Commented Jan 22, 2017 at 20:07
  • touch .xsessionrc to create a file. Commented Jun 13, 2018 at 8:28

I've had to put it in /etc/X11/xorg.conf.d/50-mouse-map.conf (and reboot) to be permanent not only over reboots but also over suspend/resume.

#instead of: xinput set-button-map "2.4G Wireless Optical Mouse" 1 2 3 4 5 6 7 0 
Section "InputClass"
    Identifier  "2.4G Wireless Optical Mouse"
    Option  "ButtonMapping" "1 2 3 4 5 6 7 0 0 10 11 12 13 14 15 16"

(if I put it just in .xsession or similar it would get executed on reboot / relogin, but would still reset to defaults after suspend/resume)

  • 4
    Be careful to not just paste xinput .. commands into this .conf file but use the conf format as shown in this answer. Else you may not be able to log in graphically! This happened to me on xenial. Commented Jun 6, 2018 at 10:56
  • 2
    You can find the option names for this method in libinput(4).
    – ash
    Commented Aug 16, 2018 at 8:19
  • 1
    seems to have moved to /etc/X11/Xsession.d/ (Ubuntu 18.04) Commented Jul 7, 2021 at 9:45
  • For me to get it to work I had to put this into /etc/xorg.conf (Linux Mint 20.3). It works after restart and after unplug/replug. This is just a slight modification of @matija-nalis answer but I can not comment only answer. # instead of xinput set-button-map "Logitech M510" 1 2 3 4 5 8 9 6 7 Section "InputClass" Identifier "Logitech M510" Option "ButtonMapping" "1 2 3 4 5 8 9 6 7" EndSection Commented Apr 30, 2022 at 15:02

Use the Startup Applications program.

Type in the terminal command and use " to separate the values.


xinput set-button-map "12" "1" "1" "3"  

Save and it works.

  • 5
    That would do changes only on startup. The OP wants setting to persist when unplugged and plugged Commented Oct 12, 2016 at 13:50
  • 1
    What do you mean by "save"?
    – MERose
    Commented Feb 7, 2022 at 9:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .