From 35269a06323820b87bed380f4e3e9b8729f80a0a Mon Sep 17 00:00:00 2001 From: Mateja Date: Thu, 4 Feb 2021 16:59:03 +0100 Subject: Add script for saving dunst notifications. --- .local/bin/save_notification.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 .local/bin/save_notification.sh diff --git a/.local/bin/save_notification.sh b/.local/bin/save_notification.sh new file mode 100755 index 0000000..4156686 --- /dev/null +++ b/.local/bin/save_notification.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +# Some notifications have empty lines that we need to remove +appname=$(echo "$1" | sed '/^$/d') +# Newline need to be converted to spaces +summary=$(echo "$2" | sed '/^$/d' | tr $'\n' ' ') +body=$(echo "$3" | sed '/^$/d' | tr $'\n' ' ') +icon=$(echo "$4" | sed '/^$/d') +urgency=$(echo "$5" | sed '/^$/d') +timestamp=$(date +"%I:%M %p") + +touch /tmp/notifications +chmod 600 /tmp/notifications +echo -en "$timestamp\n$urgency\n$icon\n$body\n$summary\n$appname\n" >> /tmp/notifications -- cgit v1.2.3