From 592bf60a638cd06b591bb14bdddd6f90d6c63f4d Mon Sep 17 00:00:00 2001 From: Luca Bilke Date: Thu, 14 Mar 2024 09:27:14 +0100 Subject: [PATCH] update togtp script --- .local/libexec/dwm/togtouchpad | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/.local/libexec/dwm/togtouchpad b/.local/libexec/dwm/togtouchpad index f2011efa..9358b6ed 100755 --- a/.local/libexec/dwm/togtouchpad +++ b/.local/libexec/dwm/togtouchpad @@ -2,13 +2,26 @@ TPdevice=$(xinput | sed -nre '/TouchPad|Touchpad/s/.*id=([0-9]*).*/\1/p') -alias off=xinput --disable "$TPdevice" && notify-send -h string:x-dunst-stack-tag:"togtp" "Touchpad Disabled" -i input-touchpad-off -alias on=xinput --enable "$TPdevice" && notify-send -h string:x-dunst-stack-tag:"togtp" "Touchpad Enabled" -i input-touchpad-on +off() { + xinput disable "$TPdevice" && notify-send -h string:x-dunst-stack-tag:"togtp" "Touchpad Disabled" -i input-touchpad-off +} +on() { + xinput enable "$TPdevice" && notify-send -h string:x-dunst-stack-tag:"togtp" "Touchpad Enabled" -i input-touchpad-on +} -[ "$1" = "-n" ] && { off; exit; } +[ "$1" = "-n" ] && { + off + exit +} -[ "$1" = "-y" ] && { on; exit; } +[ "$1" = "-y" ] && { + on + exit +} -xinput list-props "$TPdevice" | grep -oPq "Device Enabled \(\d*\):\s*1" && { off; exit; } +xinput list-props "$TPdevice" | grep -oPq "Device Enabled \(\d*\):\s*1" && { + off + exit +} on