#!/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"