Skip to content

Instantly share code, notes, and snippets.

@slowkow
Created July 7, 2015 00:00
Show Gist options
  • Save slowkow/998d23bd639a279074e0 to your computer and use it in GitHub Desktop.
Save slowkow/998d23bd639a279074e0 to your computer and use it in GitHub Desktop.
Toggle IBM TrackPoint in Ubuntu
#!/usr/bin/env bash
# toggle-trackpoint.sh
set -uoe pipefail
# xinput list
# ⎡ Virtual core pointer id=2 [master pointer (3)]
# ⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
# ⎜ ↳ SynPS/2 Synaptics TouchPad id=14 [slave pointer (2)]
# ⎜ ↳ Logitech G500 id=9 [slave pointer (2)]
# ⎜ ↳ Logitech G500 id=10 [slave pointer (2)]
# ⎜ ↳ Lenovo ThinkPad Compact USB Keyboard with TrackPoint id=11 [slave pointer (2)]
# ⎜ ↳ TPPS/2 IBM TrackPoint id=15 [slave pointer (2)]
# ⎣ Virtual core keyboard id=3 [master keyboard (2)]
# ↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
# ↳ Power Button id=6 [slave keyboard (3)]
# ↳ Video Bus id=7 [slave keyboard (3)]
# ↳ Sleep Button id=8 [slave keyboard (3)]
# ↳ AT Translated Set 2 keyboard id=13 [slave keyboard (3)]
# ↳ ThinkPad Extra Buttons id=16 [slave keyboard (3)]
# ↳ Lenovo ThinkPad Compact USB Keyboard with TrackPoint id=12 [slave keyboard (3)]
dev=$(xinput list | grep 'IBM TrackPoint')
[[ $dev =~ id=([0-9]+) ]]
id=${BASH_REMATCH[1]}
if xinput list-props 15 | grep 'Device Enabled' | grep '1$' > /dev/null; then
xinput disable $id && echo Disabled $id
else
xinput enable $id && echo Enabled $id
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment