dotfiles/.i3blocks/dunst

34 lines
650 B
Plaintext
Raw Normal View History

2020-02-24 14:15:57 +01:00
#!/bin/bash
runtime="${XDG_RUNTIME_DIR}/i3blocks"
[[ ! -d "$runtime" ]] && mkdir -p "$runtime"
2020-02-24 14:26:41 +01:00
active=$(systemctl --user show -p ActiveState --value dunst.service)
2020-02-24 14:15:57 +01:00
if [[ -n "$button" ]]
then
pid=$(systemctl --user show -p MainPID --value dunst.service)
if [[ -f "$runtime/dunst" ]]
then
2020-02-24 14:26:41 +01:00
kill -SIGUSR2 $pid
2020-02-24 14:15:57 +01:00
rm "$runtime/dunst"
else
2020-02-24 14:26:41 +01:00
kill -SIGUSR1 $pid
2020-02-24 14:15:57 +01:00
touch "$runtime/dunst"
fi
fi
echo -n "dunst "
2020-02-24 14:26:41 +01:00
if [[ "$active" == "active" ]]
2020-02-24 14:15:57 +01:00
then
2020-02-24 14:26:41 +01:00
if [[ -f "$runtime/dunst" ]]
then
echo "<span foreground=\"#FFCC66\">█</span>"
else
echo "<span foreground=\"#99CC99\">█</span>"
fi
2020-02-24 14:15:57 +01:00
else
2020-02-24 14:26:41 +01:00
echo "<span foreground=\"#F2777A\">█</span>"
2020-02-24 14:15:57 +01:00
fi