Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
How to make xinput settings persist after devices are unplugged, replugged, and after shutdown, restart, etc?

How can I run the terminal command sudo xinput set-button-map "Logitech Unifying Device. Wireless PID:101b" 1 10 3 4 5 6 7 8 9 2 at every startup?

share|improve this question

marked as duplicate by Web-E, Gilles, Rinzwind, Luis Alvarado, gertvdijk Jan 5 '13 at 17:31

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

up vote 3 down vote accepted

This command affects the GUI, so it must be executed after the GUI is set up. If you can live without your custom mouse button assignment on the login screen, add the command to your startup applications. Don't use sudo, it isn't useful here (and in fact might not work).

With a Gnome interface, the startup applications are in "System > Preferences > Startup Applications". With the Unity interface, they are in "Applications > Other > Startup Applications". See Adding program to session startup in the Ubuntu community documentation for more details.

share|improve this answer
It worked! In Startup Application I used the command without "sudo" and it worked! – user118993 Jan 5 '13 at 15:39

Use Upstart.

description     "Configuring Logitech Unifying Device"


# Start when a user logs in graphically
start on desktop-session-start

stop on runlevel [016]

console output

exec xinput set-button-map "Logitech Unifying Device. Wireless PID:101b" 1 10 3 4 5 6 7 8 9 2

The script should be placed in /etc/init/logitech-unifying-device.conf You can use a different name as long as extension is .conf.

I assumed that it is wireless device. However you can exec command on any event you find to be suitable. For details see Upstart Cookbook.

share|improve this answer
That is not true. One of the great advantages of the Upstart is that script can be tuned to run on desired event(s). In this case it might be desktop-session-start. See Run a Job When a User Logs in Graphically. – Goran Miskovic Jan 5 '13 at 16:49
You are right: I was focused on the fact that it is a wireless device neglecting xinput command but I clearly stated that it can be executed on any suitable event. :) – Goran Miskovic Jan 5 '13 at 17:12

Not the answer you're looking for? Browse other questions tagged or ask your own question.