Utilisation de dunstctl plutôt que de kill et d'un fichier témoin
This commit is contained in:
parent
a173f2c753
commit
798917e698
1 changed files with 8 additions and 19 deletions
|
@ -1,28 +1,17 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
runtime="${XDG_RUNTIME_DIR}/i3blocks"
|
|
||||||
[[ ! -d "$runtime" ]] && mkdir -p "$runtime"
|
|
||||||
|
|
||||||
active=$(systemctl --user show -p ActiveState --value dunst.service)
|
active=$(systemctl --user show -p ActiveState --value dunst.service)
|
||||||
|
|
||||||
|
if [[ "$active" == "active" ]]
|
||||||
|
then
|
||||||
if [[ -n "$button" ]]
|
if [[ -n "$button" ]]
|
||||||
then
|
then
|
||||||
pid=$(systemctl --user show -p MainPID --value dunst.service)
|
dunstctl set-paused toggle
|
||||||
if [[ -f "$runtime/dunst" ]]
|
|
||||||
then
|
|
||||||
kill -SIGUSR2 $pid
|
|
||||||
rm "$runtime/dunst"
|
|
||||||
else
|
|
||||||
kill -SIGUSR1 $pid
|
|
||||||
touch "$runtime/dunst"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -n "dunst "
|
echo -n "dunst "
|
||||||
|
|
||||||
if [[ "$active" == "active" ]]
|
if [[ "$(dunstctl is-paused)" == "true" ]]
|
||||||
then
|
|
||||||
if [[ -f "$runtime/dunst" ]]
|
|
||||||
then
|
then
|
||||||
echo "<span foreground=\"#FFCC66\">█</span>"
|
echo "<span foreground=\"#FFCC66\">█</span>"
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue