Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

2 Answers 2

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
1  
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"

task

# 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. –  schkovich 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. :) –  schkovich Jan 5 '13 at 17:12

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