dotfiles/dot_config/dunst/executable_handler.sh

72 lines
2.3 KiB
Bash
Raw Normal View History

2024-07-13 13:41:00 +03:00
#!/bin/bash
PATH="${PATH}:${HOME}/.local/bin"
# When the script is called details of the notification that triggered it will be passed via environment variables. The following variables are available: DUNST_APP_NAME, DUNST_SUMMARY, DUNST_BODY, DUNST_ICON_PATH, DUNST_URGENCY, DUNST_ID, DUNST_PROGRESS, DUNST_CATEGORY, DUNST_STACK_TAG, DUNST_URLS, DUNST_TIMEOUT, DUNST_TIMESTAMP, DUNST_DESKTOP_ENTRY, and DUNST_STACK_TAG.
#date | tee -a /tmp/dunst-events.log;
#env | grep DUNST | tee -a /tmp/dunst-events.log;
#echo | tee -a /tmp/dunst-events.log;
if [ -z "$INNER" ]; then
INNER=yes "$0" "$@" >>"/tmp/dunst-entries-$(id -u || echo "$USER").log" 2>&1;
exit;
fi
if [ "$DUNST_TIMEOUT" -eq 0 ]; then exit; fi
echo; date; env | grep -iP "^DUNST";
if [ "$DUNST_APP_NAME" = "i3" ] && [ "$DUNST_SUMMARY" = "volume" ]; then
exit;
fi;
if { [ "$DUNST_APP_NAME" = "discord" ] && [ "$DUNST_SUMMARY" = "Diamond" ]; } \
|| [[ "$DUNST_SUMMARY" =~ "<3" ]] \
|| [[ "$DUNST_SUMMARY" =~ "<22" ]] ; then
sfxc play bell;
exit;
fi;
if [ "$DUNST_DESKTOP_ENTRY" = "org.telegram.desktop" ] \
&& [[ "$DUNST_SUMMARY" =~ "Gmail Bot" ]] \
|| [ "$DUNST_DESKTOP_ENTRY" = "Thunderbird" ]; then
sfxc play windows/notify_email;
exit;
fi;
if [ "$DUNST_DESKTOP_ENTRY" = "org.telegram.desktop" ]; then
sfxc play telegram;
exit;
fi;
if [ "$DUNST_APP_NAME" = "xfce4-power-manager" ]; then
case "$DUNST_BODY" in
"System is running on Battery power") ;;
"System is running on low power") sfxc play windows/battery_low;;
#"Your Battery is charging") sfxc play hl1/medshot4;;
#"Your Battery is fully charged") sfxc play hl1/suitchargeok1;;
"Your Battery is discharging") ;;
Brightness*) sfxc play windows/information_bar;;
*) aplay ~/.local/share/sounds/button_select.wav;;
esac;
exit;
#aplay ~/.local/share/sounds/successful_hit.wav; exit;
fi;
if [ "$DUNST_APP_NAME" = "udiskie" ]; then
case "$DUNST_SUMMARY" in
"Device added") sfxc play windows/hardware_insert;;
"Device unmounted") sfxc play windows/hardware_remove;;
*) ;;
esac;
exit
fi
# sfxc play windows/notify_system_generic;
#case "$DUNST_URGENCY" in
# NORMAL) aplay /usr/share/sounds/freedesktop/stereo/dialog-information.wav ;;
# URGENT) aplay /usr/share/sounds/freedesktop/stereo/dialog-warning.wav ;;
#esac;