Commit: 06a1e7314a2bdce0b221a68eb80df34a003ac31d Parent: 77899a13424a098002268b5d9a73385b44569c1d Author: Randy Palamar Date: Fri, 3 Mar 2023 10:08:13 -0700 add trackpad toggling script Diffstat:
A | bin/trackpad | | | 16 | ++++++++++++++++ |
1 file changed, 16 insertions(+), 0 deletions(-)
diff --git a/bin/trackpad b/bin/trackpad @@ -0,0 +1,16 @@ +#!/bin/sh + +# (de)activate/toggle trackpad + +tp=$(xinput list | sed -n '/Touchpad/{s:.*↳ \(.*\)id=.*:\1:;s:[[:space:]]*$::p}') || exit 0 +enabled=$(xinput list-props "$tp" | awk '/Device Enabled/{print $4}') + +[ $# -eq 1 ] || set err +case $1 in +enable) ;; +disable) ;; +toggle) [ "$enabled" = "1" ] && set disable || set enable ;; +*) echo "usage: trackpad enable|disable|toggle"; exit 1 ;; +esac + +xinput "$1" "$tp"