commit a8130d47e507aaebdad763abaf8b10ad6e6e5bcf
parent 903c6bbb19a5a0329a92e0c3f59b0aeab7e0a203
Author: Bastien Dejean <nihilhill@gmail.com>
Date: Wed, 3 Jul 2013 12:00:04 +0200
Add notification examples
Diffstat:
4 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/examples/notification/autostart b/examples/notification/autostart
@@ -0,0 +1,3 @@
+#! /bin/sh
+
+sxhkd_notify "$SXHKD_FIFO" &
diff --git a/examples/notification/pam_environment b/examples/notification/pam_environment
@@ -0,0 +1 @@
+SXHKD_FIFO=/tmp/sxhkd-fifo
diff --git a/examples/notification/sxhkd_notify b/examples/notification/sxhkd_notify
@@ -0,0 +1,21 @@
+#! /bin/sh
+
+[ $# -ne 1 ] && exit 1
+
+status_fifo=$1
+
+{ while read -r line ; do
+ msg=${line#?}
+ case $line in
+ H*)
+ duration=2
+ ;;
+ C*)
+ duration=4
+ ;;
+ T*)
+ duration=1
+ ;;
+ esac
+ notify-send -t $duration "$msg"
+done } < "$status_fifo"
diff --git a/examples/notification/xinitrc b/examples/notification/xinitrc
@@ -0,0 +1,3 @@
+[ -e "$SXHKD_FIFO" ] && rm "$SXHKD_FIFO"
+mkfifo "$SXHKD_FIFO"
+sxhkd -s "$SXHKD_FIFO" &