summaryrefslogtreecommitdiffstats
path: root/bin/xinput-toggle
diff options
context:
space:
mode:
Diffstat (limited to 'bin/xinput-toggle')
-rwxr-xr-xbin/xinput-toggle8
1 files changed, 7 insertions, 1 deletions
diff --git a/bin/xinput-toggle b/bin/xinput-toggle
index ff038e0..78151e1 100755
--- a/bin/xinput-toggle
+++ b/bin/xinput-toggle
@@ -25,6 +25,9 @@
set -eu
+message_0='%s disabled'
+message_1='%s enabled'
+
toggle()
{
local device="${1}"
@@ -33,7 +36,10 @@ toggle()
state=$(xinput --list-props "${device}" | \
sed -n 's/^\tDevice Enabled ([0-9]*):\t\([01]\)$/\1/p;')
- xinput --set-prop "${device}" 'Device Enabled' $((${state} ^ 1))
+ state=$((${state} ^ 1))
+ xinput --set-prop "${device}" 'Device Enabled' ${state}
+ notify-send -t 1000 \
+ "$(eval "printf \"\${message_${state}}\" \"\${device}\"")"
return 0
}