Skip to content

Instantly share code, notes, and snippets.

@ixxra
Created January 12, 2019 15:20
Show Gist options
  • Save ixxra/3daf4ff8089b339e0219b2b10464556f to your computer and use it in GitHub Desktop.
Save ixxra/3daf4ff8089b339e0219b2b10464556f to your computer and use it in GitHub Desktop.
Enable tapping without a desktop environment
#!/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