Skip to content

Instantly share code, notes, and snippets.

@Peetz0r
Created October 14, 2017 08:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Peetz0r/acc2d632db3e8c0dfeaec6ccf52252a2 to your computer and use it in GitHub Desktop.
Save Peetz0r/acc2d632db3e8c0dfeaec6ccf52252a2 to your computer and use it in GitHub Desktop.
Disables touchpad and trackpoint on ThinkPad Yoga 370 (and possibly others)
#!/usr/bin/python3
from evdev import InputDevice
from syslog import syslog
switch = InputDevice('/dev/input/by-path/platform-thinkpad_acpi-event')
trackpoint = InputDevice('/dev/input/event4')
touchpad = InputDevice('/dev/input/event5')
print(switch)
print(trackpoint)
print(touchpad)
for ev in switch.read_loop():
if ev.type == 5:
if ev.value == 1:
print('tablet!')
syslog('converting to tablet')
trackpoint.grab()
touchpad.grab()
if ev.value == 0:
print('laptop!')
syslog('converting to laptop')
trackpoint.ungrab()
touchpad.ungrab()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment