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"