aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2023-02-06 10:56:44 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2023-02-06 12:08:33 +0100
commitd30af2b00b1a5a0ddb7cfd214b98718da758917a (patch)
treeea7521e0ef237e404813018e1bf785d349d1baa4
parentc5f16ead014454267163f4a8a65f8178fc7369c9 (diff)
downloadarctica-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
-rw-r--r--Makefile.am1
-rwxr-xr-xarctica-greeter-enable-tap-to-click40
-rw-r--r--debian/arctica-greeter.install1
-rw-r--r--src/arctica-greeter.vala13
4 files changed, 55 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am
index 730cceb..112eb3e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -11,6 +11,7 @@ pkglibexec_SCRIPTS = lightdm-arctica-greeter-session \
arctica-greeter-guest-session-auto.sh \
arctica-greeter-guest-session-setup.sh \
arctica-greeter-check-hidpi \
+ arctica-greeter-enable-tap-to-click \
arctica-greeter-set-keyboard-layout
EXTRA_DIST = \
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)
diff --git a/debian/arctica-greeter.install b/debian/arctica-greeter.install
index 773e2c9..e9aaf72 100644
--- a/debian/arctica-greeter.install
+++ b/debian/arctica-greeter.install
@@ -11,5 +11,6 @@ usr/share/sounds/
usr/share/xgreeters/
usr/lib/*/arctica-greeter/lightdm-arctica-greeter-session
usr/lib/*/arctica-greeter/arctica-greeter-check-hidpi
+usr/lib/*/arctica-greeter/arctica-greeter-enable-tap-to-click
usr/lib/*/arctica-greeter/arctica-greeter-set-keyboard-layout
var/lib/polkit-1/localauthority/10-vendor.d/arctica-greeter.pkla
diff --git a/src/arctica-greeter.vala b/src/arctica-greeter.vala
index 89d52b8..e193140 100644
--- a/src/arctica-greeter.vala
+++ b/src/arctica-greeter.vala
@@ -720,6 +720,16 @@ public class ArcticaGreeter : Object
}
}
+ private static void enable_tap_to_click ()
+ {
+ try {
+ Process.spawn_command_line_sync("/usr/bin/arctica-greeter-enable-tap-to-click", null, null, null);
+ }
+ catch (Error e){
+ warning ("Error while enabling tap-to-click: %s", e.message);
+ }
+ }
+
private static void activate_numlock ()
{
try {
@@ -897,6 +907,9 @@ public class ArcticaGreeter : Object
}
}
+ /* Enable touchpad tap-to-click */
+ enable_tap_to_click ();
+
Gtk.init (ref args);
Ido.init ();