diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2023-02-06 10:56:44 +0100 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2023-02-06 12:08:33 +0100 |
commit | d30af2b00b1a5a0ddb7cfd214b98718da758917a (patch) | |
tree | ea7521e0ef237e404813018e1bf785d349d1baa4 /arctica-greeter-enable-tap-to-click | |
parent | c5f16ead014454267163f4a8a65f8178fc7369c9 (diff) | |
download | arctica-greeter-d30af2b00b1a5a0ddb7cfd214b98718da758917a.tar.gz arctica-greeter-d30af2b00b1a5a0ddb7cfd214b98718da758917a.tar.bz2 arctica-greeter-d30af2b00b1a5a0ddb7cfd214b98718da758917a.zip |
Enable touchpad tap-to-click.
Ported from Slick Greeter by Mike Gabriel.
https://github.com/linuxmint/slick-greeter/commit/85f83be9977faf2482d38d2cc289f0542b1c06a4
Diffstat (limited to 'arctica-greeter-enable-tap-to-click')
-rwxr-xr-x | arctica-greeter-enable-tap-to-click | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/arctica-greeter-enable-tap-to-click b/arctica-greeter-enable-tap-to-click new file mode 100755 index 0000000..105eabe --- /dev/null +++ b/arctica-greeter-enable-tap-to-click @@ -0,0 +1,40 @@ +#!/usr/bin/python3 + +import sys +import os +import syslog +import subprocess +import re + +if __name__ == '__main__': + + try: + output = subprocess.check_output(["xinput", "list"]).decode("UTF-8") + for line in output.splitlines(): + line = line.strip().lower() + if "pointer" in line: + m = re.search(r'id=(\d+)', line) + if m: + if len(m.groups()) > 0: + device_id = m.groups()[0] + syslog.syslog(f"Found xinput pointer: id={device_id}") + props = subprocess.check_output(["xinput", "list-props", device_id]).decode("UTF-8") + for prop in props.splitlines(): + prop = prop.strip() + if "Tapping Enabled Default" in prop: + continue + if "Tapping Enabled" in prop: + syslog.syslog(" --> This device has a tap-to-click property") + m = re.search(r'Tapping Enabled \((\d+)\):', prop) + if m: + if len(m.groups()) > 0: + prop_id = m.groups()[0] + syslog.syslog(f" --> Tapping Enabled property ID: {prop_id}") + syslog.syslog(f" --> Calling 'xinput set-prop {device_id} {prop_id} 1'") + subprocess.check_output(["xinput", "set-prop", device_id, prop_id, "1"]) + + except Exception as e: + # best effort, syslog it and bail out + syslog.syslog("ERROR: %s" % e) + + sys.exit(0) |