I'm an Ubuntu 13.04 user and I'm trying to run a script at startup. I created it in /etc/init.d/, gave it chmod 755 and ran the update-rc.d <your script> defaults command. The script is remapping my mouse's keybindings and contains the following:

#! /bin/sh
xinput set-button-map 10 1 2 3 4 5 6 7 9 8

It runs correctly if I do it manually, but I want it to run with startup.


Wouldn't that run it before there's an X Server around for it to interface with?

The simplest way to get this to work would just be to add sh -c "xinput set-button-map 10 1 2 3 4 5 6 7 9 8" to your start-up applications and that'll run it when you log in.

There's also /etc/xdg/autostart for all users, into which you can write .desktop files (look at the existing ones for syntax help).


If you add scripts to the rc.d it will start before the Xserver or xorg is up, also it will apply from the root user perspective. The most preferable place to do this is /etc/X11/xinit/xinput.d/ for system wide X start up scripts or ~/.xinputrc for users based ones.

For this you should install im-config (it should be the default in Ubuntu) and add your script in that folder or file.

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.