aboutsummaryrefslogtreecommitdiff
path: root/.local/bin
diff options
context:
space:
mode:
Diffstat (limited to '.local/bin')
-rwxr-xr-x.local/bin/save_notification.sh14
1 files changed, 14 insertions, 0 deletions
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