8

I don't like the default functionality of the mouse's scroll wheel click doing a "paste". I can change that by doing the follwing:

$ xinput set-button-map 12 1 0 3 4 5 6 7

This works fine, but if I reboot, I have to remember to do it again.

My question is how can I make this happen automatically if I need to reboot, etc?

I'm using Ubuntu 12.04

Braiam
  • 67,791
  • 32
  • 179
  • 269
David S
  • 181

3 Answers3

3

You have to add that line in your .xsessionrc file. To do this, use the following command:

echo "xinput set-button-map 12 1 0 3 4 5 6 7" >> ~/.xsessionrc
Radu Rădeanu
  • 169,590
2

You can either run the command at every login or you can put it in the X.org configuration (/etc/X11/xorg.conf) like this:

Section "InputDevice"
    Identifier     "Logitech USB-PS/2 Optical Mouse"
    Driver         "evdev"
    Option         "Device" "/dev/input/by-id/usb-Logitech_USB-PS_2_Optical_Mouse-event-mouse"
    Option         "ButtonMapping" "12 1 0 3 4 5 6 7"
EndSection

I don't know the identifiers and driver options of your device, but you get those with xinput and by sniffing around in /dev/input.

David Foerster
  • 36,264
  • 56
  • 94
  • 147
0

If you use startx or init 3, the xessionrc is a good solution

echo "xinput..yourcommand" >> $HOME/.xsessionrc

If you use xfce on init 4/5 a good solution is to create a .destkop file which point to a script, in which you type the commands.

For example

vim  .config/autostart/xinput.desktop
    [Desktop Entry]
    Hidden=false
    Version=1.0
    Name=xinput
    Name[no]=xinput
    Name[pt_BR]=xinput
    Name[ru]=xinput
    Name[sl]=xinput
    Name[sv]=xinput
    Comment=xinput
    Comment[no]=xinput
    Icon=xinput
    Terminal=false
    Type=Application
    StartupNotify=false
    Categories=System;
    Exec=/home/you/scripts/xinput.sh
    RunHook=0

vim /home/you/scripts/xinput.sh

#!/bin/bash
xinput..yourcommand

Make it executable

chmod +x /home/you/scripts/xinput.sh

At the next login the command will run.

elbarna
  • 224
  • 5
  • 13