aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMateja <mail@matejamaric.com>2021-02-04 16:59:03 +0100
committerMateja <mail@matejamaric.com>2021-02-04 16:59:03 +0100
commit35269a06323820b87bed380f4e3e9b8729f80a0a (patch)
tree2915d067e8661409dcd03985becdd216882173ee
parenta1484919a9eb617b5c9d1ca46893ffa77e594cf9 (diff)
downloaddotfiles-35269a06323820b87bed380f4e3e9b8729f80a0a.tar.gz
dotfiles-35269a06323820b87bed380f4e3e9b8729f80a0a.zip
Add script for saving dunst notifications.
-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