#!/bin/dash # gets executed each time dunst receives a notification # ignore some apps if echo "$2" | grep -q 'instantASSIST'; then exit fi # some apps dont need/already have notification sounds if ! echo "$1" | grep -Eiq '(discord|spotify|thunderbird|mailspring)'; then if ! [ -e ~/instantos/notifications/notification.ogg ]; then if ping -c 1 google.com; then mkdir -p ~/instantos/notifications/ wget -qO ~/instantos/notifications/notification.ogg \ "https://notificationsounds.com/notification-sounds/me-too-603/download/ogg" else exit fi fi mpv ~/instantos/notifications/notification.ogg fi # escape characters that cause problems with pango cleanstring() { echo "$@" | sed 's/&/&/g' | sed 's/<.*>\(.*\)<\/.*>/\1/g' } # add pango markup echo "($(date +%H:%M)) [$(cleanstring $1)] $(cleanstring $2) | $(cleanstring $3)" >>/tmp/notifications/notif.txt