summaryrefslogtreecommitdiffstats
path: root/bin/xinput-toggle
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2018-06-27 15:57:44 (EDT)
committer P. J. McDermott <pj@pehjota.net>2018-06-27 15:57:44 (EDT)
commitcd5f45bee92cb22f13ec1b2d4bcda13e476d565a (patch)
tree88a66642dffd65e085a487d891c448f100fe2477 /bin/xinput-toggle
parent6cd92aecc801bc96d87b70d82bbacbb43bbed4cf (diff)
downloadfluxbox-cd5f45bee92cb22f13ec1b2d4bcda13e476d565a.zip
fluxbox-cd5f45bee92cb22f13ec1b2d4bcda13e476d565a.tar.gz
fluxbox-cd5f45bee92cb22f13ec1b2d4bcda13e476d565a.tar.bz2
bin/xinput-toggle: Send state notification
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
}