aboutsummaryrefslogtreecommitdiff
path: root/.local/bin/save_notification.sh
blob: 41566866b5573bcd7ca53f4c594020c04fbb49f5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
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