Add dunst i3blocks script

This commit is contained in:
Breizh 2020-02-24 14:15:57 +01:00
parent 2213387892
commit 86fe4882e9

27
.i3blocks/dunst Executable file
View file

@ -0,0 +1,27 @@
#!/bin/bash
runtime="${XDG_RUNTIME_DIR}/i3blocks"
[[ ! -d "$runtime" ]] && mkdir -p "$runtime"
if [[ -n "$button" ]]
then
pid=$(systemctl --user show -p MainPID --value dunst.service)
if [[ -f "$runtime/dunst" ]]
then
killall -SIGUSR2 $pid
rm "$runtime/dunst"
else
killall -SIGUSR1 $pid
touch "$runtime/dunst"
fi
fi
echo -n "dunst "
if [[ -f "$runtime/dunst" ]]
then
echo "<span foreground=\"#FFCC66\">█</span>"
else
echo "<span foreground=\"#99CC99\">█</span>"
fi