From fa6f170e78daac08ce18f934777c7884e6f75682 Mon Sep 17 00:00:00 2001 From: Joakim Hulthe Date: Wed, 28 Feb 2024 14:12:52 +0100 Subject: [PATCH] Add script to easily send replaceable notifys --- tree/.local/bin/notify-set | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 tree/.local/bin/notify-set diff --git a/tree/.local/bin/notify-set b/tree/.local/bin/notify-set new file mode 100755 index 0000000..f0ca498 --- /dev/null +++ b/tree/.local/bin/notify-set @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +# Send a notification using notify-send, but also give it a name to make it easily replaceable. + +ID="$1" +DIR="/tmp/notify-ids/$(whoami)" +ID_PATH="$DIR/$ID" + +mkdir -p "$DIR" + +REPLACE_ID="$(cat "$ID_PATH" 2>/dev/null)"; +if [ -n "$REPLACE_ID" ]; then + REPLACE_ID="--replace-id=$REPLACE_ID" +fi + +notify-send $REPLACE_ID --print-id "${@:2}" > "$ID_PATH"