From d9b86469dccdc8bbf2ca8d38fd4668bc1ae77769 Mon Sep 17 00:00:00 2001 From: Breizh Date: Mon, 24 Feb 2020 14:15:57 +0100 Subject: [PATCH] Add dunst i3blocks script --- .i3blocks/dunst | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 .i3blocks/dunst diff --git a/.i3blocks/dunst b/.i3blocks/dunst new file mode 100755 index 0000000..fa291fb --- /dev/null +++ b/.i3blocks/dunst @@ -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 "" +else + echo "" +fi +