Created
October 14, 2017 08:40
-
-
Save Peetz0r/acc2d632db3e8c0dfeaec6ccf52252a2 to your computer and use it in GitHub Desktop.
Disables touchpad and trackpoint on ThinkPad Yoga 370 (and possibly others)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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