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.

On my Thinkpad I need to execute something like this in the terminal:

xinput set-int-prop "TPPS/2 IBM TrackPoint" "Evdev Middle Button Emulation" 8 1

so that my the 2 buttons on my touchpad emulate the middle mouse click. Now I need this line to be executed each time I start GNOMe or X or whatever, so that it "just works".

I tried ~/.xsession or ~/.bashrc but to no avail. Should I put it in GNOME start scripts or in /etc/X somewhere?

I'm using Ubuntu 11.10.

share|improve this question
    
Try adding a sleep 5 in the beginning of your .xsession file? –  Thomas Ahle Aug 3 '12 at 14:22
1  
@ThomasAhle that won't solve the problem if the window manager is loaded and changes evdev properties after the .xsession is executed. –  Marcin Kaminski Oct 17 '12 at 0:25
add comment

4 Answers 4

I'm using Enlightenment DM, but that's relevant to other DMs/desktops. I start my session using xsession so I initially put xinput commands in ~/.xsession which didn't change all settings I wanted to change. Only some of them. I was expecting either all or no changes, so I added a 10-interation loop to my .xsession with 1 second intervals, running xinput commands each time and checking if the settings were applied. To my surprise, all settings were applied after the first iteration.

This means that it's your DM that does something to override your xinput settings and since the command that launches your DM (E17 in my case) is the last one in your .xsession file, this file is no place for this.

I've added the following lines in my ~/.profile and this has solved the problem:

# don't run unless we're being invoked from an xwindows session
if [[ -n ${DISPLAY} ]]; then

  # set your devices names here
  pointer1="IBM TrackPoint"
  pointer2="Lite-On Technology Corp. ThinkPad USB Keyboard with TrackPoint"
  pointer3="Logitech USB Trackball"

  id1=$(xinput | awk -F= "/$pointer1.*pointer/ {print \$2}" | cut -f1)
  id2=$(xinput | awk -F= "/$pointer2.*pointer/ {print \$2}" | cut -f1)
  id3=$(xinput | awk -F= "/$pointer3.*pointer/ {print \$2}" | cut -f1)

  if [[ -n "${id1}" ]]; then
    xinput --set-button-map "${id1}" 1 2 3 4 5 6 7
    xinput set-prop "${id1}"  "Evdev Wheel Emulation Axes" 6 7 4 5
    xinput set-prop "${id1}"  "Evdev Wheel Emulation" 1
    xinput set-prop "${id1}"  "Evdev Wheel Emulation Button" 2
    xinput set-prop "${id1}"  "Evdev Middle Button Emulation" 0
  fi

  if [[ -n "${id2}" ]]; then
    xinput --set-button-map "${id2}" 1 2 3 4 5 6 7
    xinput set-prop "${id2}"  "Evdev Wheel Emulation Axes" 6 7 4 5
    xinput set-prop "${id2}"  "Evdev Wheel Emulation" 1
    xinput set-prop "${id2}"  "Evdev Wheel Emulation Button" 2
    xinput set-prop "${id2}"  "Evdev Middle Button Emulation" 0
  fi

  if [[ -n "${id3}" ]]; then
    xinput --set-button-map "${id3}" 1 2 3 4 5 6 7 8 9
    xinput set-prop "${id3}"  "Evdev Wheel Emulation Axes" 6 7 4 5
    xinput set-prop "${id3}"  "Evdev Wheel Emulation" 1
    xinput set-prop "${id3}"  "Evdev Wheel Emulation Button" 8
    xinput set-prop "${id3}"  "Evdev Middle Button Emulation" 1
  fi
fi

PS. set-int-prop has been deprecated in favour of set-prop (man xinput).

Hopefully this helps someone.

share|improve this answer
add comment

Create a file in /etc/X11/Xsession.d/ for it.

share|improve this answer
    
For me that was /etc/X11/xinit/Xsession –  Thomas Ahle Aug 3 '12 at 14:19
2  
I generally don't encourage making user-specific configuration changes in a system-wide configuration file. Firstly because it creates an additional thing to remember about when you need to migrate to a different machine and secondly, because these files are mostly there to provide sane defaults. It's nice to be able to just take the snapshot of your $HOME and the list of installed packages with you when you need to reinstall/migrate. –  Marcin Kaminski Oct 17 '12 at 0:26
add comment

Add the command directly to startup applications. In the command field.

or

make a simple script and add the script to startup applications.

share|improve this answer
add comment

This is how I did it in Ubuntu 14.04 from the terminal:

1) Check the name of your device:

xinput list

2) See available options for your device:

xinput list-props "Your Device Name"

3) Edit settings (to make settings consistent after reboot/shutdown just add this command to Startup Applications):

xinput set-prop "Your Device Name" "Option Name" "Value"

Here is an example command I used to activate locked drags in my touchpad:

xinput set-prop "SynPS/2 Synaptics TouchPad" "Synaptics Locked Drags" 1

To activate/change another option just look for it in your device available options and play with them until you get the desired result, then add the command to Startup Applications and you're done! Hope it helps! : )

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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