Created
January 12, 2019 15:20
-
-
Save ixxra/3daf4ff8089b339e0219b2b10464556f to your computer and use it in GitHub Desktop.
Enable tapping without a desktop environment
This file contains 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/env python | |
import subprocess | |
import re | |
XINPUT = "xinput list" | |
ID_RE = "id=([0-9]+)" | |
TAPPING_ENABLE_COMMAND = "libinput Tapping Enabled" | |
def touchpadId(): | |
data = subprocess.getoutput(XINPUT).split("\n") | |
data = list(filter(lambda s: "TouchPad" in s, data)) | |
data = data[0] | |
m = re.search(ID_RE, data) | |
id = int( m.group(1)) | |
return id | |
def setupTap(id, enable=True): | |
cmd = ["xinput", | |
"--set-prop", str(id), | |
TAPPING_ENABLE_COMMAND, str(int(enable))] | |
return subprocess.call(cmd) | |
if __name__ == "__main__": | |
id = touchpadId() | |
setupTap(id) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment