notifier

Checks current IM messages for different platforms and sends a notification for new messages
git clone https://src.jayvii.de/pub/notifier.git
Log | Files | Refs | README

commit c3af8314eedc10c1dd10b9271e95e71d8a574f65
parent d52116066c714e79454f029be8c23ff04e11b3b6
Author: JayVii <jayvii@posteo.de>
Date:   Mon, 23 Aug 2021 14:05:11 +0200

Option to disable LED

Diffstat:
Mim-notifier.sh | 19++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/im-notifier.sh b/im-notifier.sh @@ -6,8 +6,10 @@ TIMEOUT=25 # Telegram Settings TELEGRAM=1 +TG_LED=1 TG_NOTIFICATION_ID=0 + # Modules --------------------------------------------------------------------- ## Common @@ -22,8 +24,11 @@ function im_notify { # unfortunately, this does not replace old messages notify-send --app-name="$3" --icon="$3" --category="im.received" \ "$1" "$4" + echo 0 + fi + if [[ $5 != 0 ]]; then + echo 1 > /sys/devices/platform/leds/leds/blue\:indicator/brightness fi - echo 1 > /sys/devices/platform/leds/leds/blue\:indicator/brightness } function im_unnotify { if [[ "$XDG_CURRENT_DESKTOP" == "GNOME:Phosh" ]]; then @@ -32,8 +37,12 @@ function im_unnotify { --object-path=/org/freedesktop/Notifications \ --method=org.freedesktop.Notifications.CloseNotification \ $1 + else + echo 0 + fi + if [[ $2 != 0 ]]; then + echo 0 > /sys/devices/platform/leds/leds/blue\:indicator/brightness fi - echo 0 > /sys/devices/platform/leds/leds/blue\:indicator/brightness } ## Telegram @@ -49,13 +58,13 @@ function tg_kill { fi } function tg_notify { - im_notify "Telegram" $2 "telegram" "$1" + im_notify "Telegram" $2 "telegram" "$1" $TG_LED } # Run Daemon ------------------------------------------------------------------ # Notify user about running state of the daemon -im_notify "IM-Notifier" 0 "gnome-settings" "IM-Notifier is running..." +im_notify "IM-Notifier" 0 "gnome-settings" "IM-Notifier is running..." 0 # Run daemon in endless while-loop while :; do @@ -87,6 +96,6 @@ while :; do done # Notify user about running state of the daemon -im_notify "IM-Notifier" 0 "gnome-settings" "IM-Notifier stopped..." +im_notify "IM-Notifier" 0 "gnome-settings" "IM-Notifier stopped..." 0 # EOF im-notifier.sh