sxalertd

sxalert pseudo-daemon hack
git clone git://mcdim.xyz/sxalertd.git
Log | Files | Refs | README | LICENSE

sxalertd (702B)


      1 #!/bin/sh
      2 # Very very hacky script to read notifications from D-Bus and draw them with sxalert
      3 
      4 count=3
      5 dbus-monitor "interface='org.freedesktop.Notifications',member='Notify'" | stdbuf -oL -eL sed 's/         string/sstring/g' | grep "string" --line-buffered |
      6 while read -r message; do
      7 	if printf "%s" $message | grep -E "^sstring" > /dev/null; then
      8 		if ! [ "$combtext" = "" ]; then
      9 			IFS='"' read -ra args_array <<< "$combtext"
     10 			sxalert "${args_array[@]}"
     11 		fi
     12 		count=2;
     13 		combtext=""
     14 	fi
     15 
     16 	if [ $count -lt 0 ]; then
     17 		text=`echo $message | cut -d\" -f2`
     18 		if ! [ "$text" = "" ]; then
     19 			combtext="$combtext $text\""
     20 		fi
     21 	fi
     22 
     23 	count=$((count-1))
     24 	if [ $count -lt -2 ]; then
     25 		count=4
     26 	fi
     27 done