From 29eefa99e399f84252703e9d058083814947148e Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Thu, 30 Apr 2026 02:16:54 -0700 Subject: [PATCH] sni: add tray restart helper --- dotfiles/lib/bin/restart_snis.sh | 51 ++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100755 dotfiles/lib/bin/restart_snis.sh diff --git a/dotfiles/lib/bin/restart_snis.sh b/dotfiles/lib/bin/restart_snis.sh new file mode 100755 index 00000000..4c3e91e8 --- /dev/null +++ b/dotfiles/lib/bin/restart_snis.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash +set -euo pipefail + +core_services=( + status-notifier-watcher.service + taffybar.service +) + +tray_services=( + blueman-applet.service + flameshot.service + kanshi-sni.service + kdeconnect-indicator.service + keepbook-sync-daemon.service + network-manager-applet.service + notifications-tray-icon-gitea.service + notifications-tray-icon-github.service + notifications-tray-icon-gmail.service + pasystray.service + tailscale-systray.service + udiskie.service +) + +restart_if_loaded() { + local service=$1 + + if systemctl --user cat "$service" >/dev/null 2>&1; then + systemctl --user restart "$service" + fi +} + +systemctl --user reset-failed "${core_services[@]}" "${tray_services[@]}" 2>/dev/null || true + +for service in "${core_services[@]}"; do + restart_if_loaded "$service" +done + +for service in "${tray_services[@]}"; do + restart_if_loaded "$service" +done + +sleep "${SNI_RESTART_SETTLE_SECONDS:-5}" + +if command -v busctl >/dev/null 2>&1 && + busctl --user status org.kde.StatusNotifierWatcher >/dev/null 2>&1; then + busctl --user get-property \ + org.kde.StatusNotifierWatcher \ + /StatusNotifierWatcher \ + org.kde.StatusNotifierWatcher \ + RegisteredStatusNotifierItems +fi