commit e4a165da91f6a828547d73a413da47b86a0478f7 parent a66976a84b2174f172cd0f0103e963172af5460c Author: JayVii <jayvii[AT]posteo[DOT]de> Date: Sun, 22 Aug 2021 14:07:28 +0200 Close notification if not needed; use LEDs Diffstat:
M | telegram-notifier/telegram-notifier.sh | | | 14 | +++++++++++++- |
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/telegram-notifier/telegram-notifier.sh b/telegram-notifier/telegram-notifier.sh @@ -25,6 +25,16 @@ function notify_telegram { "Telegram" $2 "telegram" "Telegram" "$1" \ '[]' '{"category": <"im.received">, "desktop-entry": <"telegram">}' \ 3000 + echo 1 > /sys/devices/platform/leds/leds/pinephone\:blue/brightness +} + +function unnotify_tg { + gdbus call --session \ + --dest=org.freedesktop.Notifications \ + --object-path=/org/freedesktop/Notifications \ + --method=org.freedesktop.Notifications.CloseNotification \ + $1 + echo 0 > /sys/devices/platform/leds/leds/pinephone\:blue/brightness } while :; do @@ -37,8 +47,10 @@ while :; do UNREADMSG=$(check_telegram) if [[ ! -z "$UNREADMSG" ]]; then - REPLACEID=$(notify_telegram "$UNREADMSG" "$REPLACEID" | sed -e 's/^.*\s//' -e 's/[^0-9]//g') + else + unnotify_tg $REPLACEID + REPLACEID=0 fi fi