You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
791 B
33 lines
791 B
4 years ago
|
#!/usr/bin/env sh
|
||
|
NOTIFDIR="$XDG_CONFIG_HOME"/sxmo/notifications
|
||
|
|
||
|
notificationmenu() {
|
||
|
CHOICES="Close Menu"
|
||
|
for NOTIFFILE in "$NOTIFDIR"/*; do
|
||
|
NOTIFMSG="$(tail -n+3 "$NOTIFFILE" | tr "\n^" " ")"
|
||
|
NOTIFHRANDMIN="$(stat --printf %y "$NOTIFFILE" | grep -oE '[0-9]{2}:[0-9]{2}')"
|
||
|
CHOICES="
|
||
|
$CHOICES
|
||
|
$NOTIFHRANDMIN - $NOTIFMSG ^ $NOTIFFILE
|
||
|
"
|
||
|
done
|
||
|
|
||
|
PICKEDCONTENT="$(
|
||
|
printf "%b" "$CHOICES" |
|
||
|
xargs -0 echo |
|
||
|
sed '/^[[:space:]]*$/d' |
|
||
|
awk '{$1=$1};1' |
|
||
|
cut -d^ -f1 |
|
||
|
dmenu -c -i -fn "Terminus-18" -p "Notifs" -l 10
|
||
|
)"
|
||
|
|
||
|
[ "$PICKEDCONTENT" = "Close Menu" ] && exit 1
|
||
|
|
||
|
PICKEDNOTIFFILE="$(echo "$CHOICES" | grep "$PICKEDCONTENT" | cut -d^ -f2 | tr -d ' ')"
|
||
|
NOTIFACTION="$(head -n1 "$PICKEDNOTIFFILE")"
|
||
|
eval "$NOTIFACTION" &
|
||
|
rm "$PICKEDNOTIFFILE"
|
||
|
}
|
||
|
|
||
|
notificationmenu
|