aboutsummaryrefslogtreecommitdiffstats
path: root/config/hypr/scripts/Refresh.sh
diff options
context:
space:
mode:
Diffstat (limited to 'config/hypr/scripts/Refresh.sh')
-rwxr-xr-xconfig/hypr/scripts/Refresh.sh39
1 files changed, 31 insertions, 8 deletions
diff --git a/config/hypr/scripts/Refresh.sh b/config/hypr/scripts/Refresh.sh
index 03f55fa0..947b6bfc 100755
--- a/config/hypr/scripts/Refresh.sh
+++ b/config/hypr/scripts/Refresh.sh
@@ -43,16 +43,39 @@ for pid in $(pidof rofi swaync ags swaybg); do
sleep 0.1
done
-# Reload or start waybar once
-if pidof waybar >/dev/null; then
- if command -v waybar-msg >/dev/null 2>&1; then
- waybar-msg cmd reload >/dev/null 2>&1 || true
+# Restart waybar once (works with systemd user unit or manual launch setups)
+restart_waybar() {
+ local manage_with_systemd=0
+
+ if command -v systemctl >/dev/null 2>&1; then
+ if systemctl --user --quiet is-active waybar.service 2>/dev/null || systemctl --user --quiet is-enabled waybar.service 2>/dev/null; then
+ manage_with_systemd=1
+ fi
+ fi
+
+ if [ "$manage_with_systemd" -eq 1 ]; then
+ systemctl --user stop waybar.service >/dev/null 2>&1 || true
+ fi
+
+ pkill -x waybar >/dev/null 2>&1 || true
+ pkill -x '.waybar-wrapped' >/dev/null 2>&1 || true
+ sleep 0.2
+ if pgrep -x waybar >/dev/null 2>&1 || pgrep -x '.waybar-wrapped' >/dev/null 2>&1; then
+ pkill -9 -x waybar >/dev/null 2>&1 || true
+ pkill -9 -x '.waybar-wrapped' >/dev/null 2>&1 || true
+ fi
+ sleep 0.2
+
+ if [ "$manage_with_systemd" -eq 1 ]; then
+ if ! systemctl --user start waybar.service >/dev/null 2>&1; then
+ waybar >/dev/null 2>&1 &
+ fi
else
- killall -SIGUSR2 waybar 2>/dev/null || true
+ waybar >/dev/null 2>&1 &
fi
-else
- waybar &
-fi
+}
+
+restart_waybar
# relaunch swaync
sleep 0.3
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage