1

I'm trying to run on startup via cronjob/rc.local/upstart a script which will change the settings of my mouse. My scripts when invoking xinput echo nothing (they echo as they should when I'm logged in).

When is xinput available? When is it loaded?

I wish to run the following command as root at startup: xinput 1> /var/log/xinput.log 2>&1

  • Hi Karl, did you notice my answer? Please let me know if it helps (or not). – Jacob Vlijm Dec 3 '15 at 6:00
  • You didn't mention you ran it as root... – Jacob Vlijm Dec 3 '15 at 6:29
  • @JacobVlijm I tried to run as root but then reverted to the user! The ultimate goal is to run it as root now! (I've been playing with upstart, cronjob, rc-local for 2 days now, nothing seems to get it going). – Karl Morrison Dec 3 '15 at 6:31
0

I actually had to use xinput for my own mouse to swap the buttons around.

Typically what I do (running KDE, though any distro should have something similar) is open the "startup" application manager. In KDE it's called Autostart. Then you just add your script file and you are done. On next reboot it will load up and your mouse will be working as you set it.

As for doing it in cron or anything else... (at least in cron) DO NOT type out the command itself in cron. I know when I have run scripts in the past in cron it is necessary to point it to the file itself. This will of course cause it to run that file you pointed it to at the specified time.

What else? Make sure your script file is correct. It's completely possible you accidentally did something wrong. I know I did it at first unintentionally just transposing a couple things.

Example file:

mouse.sh

#!/bin/bash
xinput set-button-map "9" 1 2 3 4 5 8 9 6 7 10 11 12 13

(command) (option) ("Device ID") (Button Order)

  • Yea I have the script file complete so that's not the issue. I've realized that xinput command isn't working as it should. I'm suspecting that xserver hasn't started before the scripts are run. – Karl Morrison Dec 2 '15 at 4:13

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.