aboutsummaryrefslogtreecommitdiff
path: root/misc-root/etc/acpi
diff options
context:
space:
mode:
authorYuchen Pei <id@ypei.org>2023-09-30 17:24:03 +1000
committerYuchen Pei <id@ypei.org>2023-09-30 17:24:03 +1000
commit00670960f7ca8f56fc60623571137826a1893839 (patch)
treeefccd23456bea9bf81f68adeccd8e1db98ac5cc6 /misc-root/etc/acpi
parentc1d82d09ab1ab4d8f5ac0c610a3258af63573f15 (diff)
[acpid] Add config/scripts to toggle touchpad on laptop lid events
Diffstat (limited to 'misc-root/etc/acpi')
-rwxr-xr-xmisc-root/etc/acpi/actions/lid.sh17
-rw-r--r--misc-root/etc/acpi/events/lid2
2 files changed, 19 insertions, 0 deletions
diff --git a/misc-root/etc/acpi/actions/lid.sh b/misc-root/etc/acpi/actions/lid.sh
new file mode 100755
index 0000000..6bf2c59
--- /dev/null
+++ b/misc-root/etc/acpi/actions/lid.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+# Turn off/on touchpad when lid is closed/open
+# Guess the touchpad name
+touch_name=$(DISPLAY=:0 xinput list --name-only | grep -i touchpad)
+case "$3" in
+ close)
+ DISPLAY=:0 xinput set-prop "$touch_name" "Device Enabled" 0 &&
+ logger "Touchpad disabled"
+ ;;
+ open)
+ DISPLAY=:0 xinput set-prop "$touch_name" "Device Enabled" 1 &&
+ logger "Touchpad enabled"
+ ;;
+ *)
+ logger "ACPI action undefined: $3"
+ ;;
+esac
diff --git a/misc-root/etc/acpi/events/lid b/misc-root/etc/acpi/events/lid
new file mode 100644
index 0000000..6479acc
--- /dev/null
+++ b/misc-root/etc/acpi/events/lid
@@ -0,0 +1,2 @@
+event=button/lid.*
+action=/etc/acpi/actions/lid.sh %e \ No newline at end of file