Skip to content

Instantly share code, notes, and snippets.

@lukas-buergi
Created May 6, 2016 19:50
Show Gist options
  • Save lukas-buergi/02186dd9d9533adee3f4dd691d3e5078 to your computer and use it in GitHub Desktop.
Save lukas-buergi/02186dd9d9533adee3f4dd691d3e5078 to your computer and use it in GitHub Desktop.
Sets up 2d scroll for trackball
#!/bin/bash
# use xinput to get hardware id, xinput --list-props id to get order of
# hardware buttons for your mouse
# hardware software
# 1 large one left left click
# 2 both large ones middle click
# 3 large one right right click
# 4 trackball down scroll up
# 5 trackball up scroll down
# 6 trackball left scroll left
# 7 trackball right scroll right
# 8 small one left thumb 1
# 9 small one right thumb 2
# 10 ExtBt7
# 11 ExtBt8
if [[ $(xinput list) =~ 'Trackball' ]]; then
echo "Setting up Logitech trackball"
# this line doesn't seem to work. It does have an effect, though.
xinput set-button-map 'Logitech USB Trackball' '1 2 3 4 5 6 7 2 2'
# enable wheel emulation
xinput --set-prop --type='int' --format='8' 'Logitech USB Trackball' 'Evdev Wheel Emulation' '1'
# which buttons to use for scrolling
xinput --set-prop --type='int' --format='8' 'Logitech USB Trackball' 'Evdev Wheel Emulation Button' '8'
# pixels before scrolling reacts
xinput --set-prop --type='int' --format='16' 'Logitech USB Trackball' 'Evdev Wheel Emulation Inertia' '1'
# milliseconds before scrolling reacts, less is more comfortable for scrolling, but middle mouse click is only registered if it's faster than this.
xinput --set-prop --type='int' --format='16' 'Logitech USB Trackball' 'Evdev Wheel Emulation Timeout' '120'
# disable middle button emulation
xinput --set-prop --type='int' --format='8' 'Logitech USB Trackball' 'Evdev Middle Button Emulation' '0'
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment