2

This one bugs me.

I fashioned this handy script to swap the left and right mouse buttons over: [My mouse is a Razer]

/usr/bin/xinput set-button-map `xinput list | grep 'Razer' | grep -o \=[0-9]* | grep -o [0-9]*$` 3 2 1 4 5 6 7 8 1 10 11 12 13

When I run this in a Terminal it works.

When I go to Startup Application Preferences -> Add and then literally paste the above into the command field as an 'Additional startup program' It does not run on startup.

Why not?

I'm using Ubuntu 11-10 but this also applied to the 10-10

2

I've had various things like that fail before. I'm honestly not sure if it's just a problem with the way the commands are stored or an issue with whatever limited environment these commands are run with.

Either way there are two options that have both worked for me:

  • Write a little bash script. It can pretty much be your command with a #!/bin/bash stanza at the top (I've broken it up to read better):

    #!/bin/bash
    
    DEV=$(xinput list | grep 'Razer' | grep -o \=[0-9]* | grep -o [0-9]*$)
    /usr/bin/xinput set-button-map $DEV 3 2 1 4 5 6 7 8 1 10 11 12 13
    

    Then just save that somewhere like ~/.mousescript and call bash ~/.mousescript as your start-up command.

  • Or just wrap your command in bash:

    bash -c "/usr/bin/xinput set-button-map `xinput list | grep 'Razer' | grep -o \=[0-9]* | grep -o [0-9]*$` 3 2 1 4 5 6 7 8 1 10 11 12 13"
    
  • yep I wrapped it in a bash -c and it works fine now - thanks – andy boot Mar 27 '12 at 19:27

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.