5

The gui-based controls for mouse acceleration do not suffice to tame my mouse, so I am correcting this by running:

xinput set-prop 10 "Device Accel Constant Deceleration" 2.9

This script has the desired effect (every time) when run manually from the terminal. However I have yet to find a way to run it on each login. Attempts to have it execute through rc.local or using the script launching options in the system settings have both remained fruitless.

Do you have any suggestions of what else I could try? Should I modify X11 config files directly? Several posts related to this topic advised against doing so.

1
  • 1
    You might need to specify the X info by putting something like DISPLAY=:0 in your script, otherwise xinput doesn't know about X.
    – Nattgew
    Apr 29, 2014 at 17:56

2 Answers 2

0

One way is to use a cron job with the reboot directive which will run at every system's start (and reboot).

To do so:

  • Issue sudo crontab -e to enter a cron job to root's crontab
  • In a new line enter @reboot xinput set-prop 10 "Device Accel Constant Deceleration" 2.9 2>&1 >> /var/log/my_xinput.log

If the job is not running, you might want to point the full path to the xinput command.

By saying the full path to the command (xinput) i mean, that cron need to know where to find the executable - script that needs to run. This can be done either by:

  • pointing cron to the full path of what needs to be executed, for example I have a script located at ~/bin/myscript.sh; to be sure that cron knows where to find my script, I must enter it's full path to the cronjob, that is /home/username/bin/myscript.sh.
  • Or by setting environment variables at the crontab file and before my cronjob, such as:

SHELL=/bin/sh to specify which shell to use PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/home/username/bin note the last entry, etc

For your problem try:

/usr/bin/xinput set-prop 10 "Device Accel Constant Deceleration" 2.9

Finally you may want to check this references about Cron:

0
0

Not having any luck with crontab either, I was able to get the my script to start on each login. However this is a KDE-specific solution, so I'm not sure it's valid for AskUbuntu.

Anyway, here goes my solution:

fix_mouse_accel.sh

#!/bin/bash

/usr/bin/xinput set-prop 10 "Device Accel Constant Deceleration" 2.9

Make sure the file is executable:

chmod 755 fix_mouse_accel.sh

Then go to System Settings > Startup and Shutdown. Click on Add Script and point to your script. Untick the symlink box unless you want to keep a local copy somewhere; Personally I prefer to have the file "disappear" into KDE config folders as I won't touch it anymore.

1
  • Hi Adrian. Although this might work in most cases, I'd build in a break of 10-15 seconds before the acctual setting is done. Many times, commands on screens, mice, keyboards etc are overruled by local stuff after login. (and after you run this script). Jun 27, 2016 at 8:28

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