adds waybar reload on config change

This commit is contained in:
Michael Beck 2025-05-20 14:50:05 +02:00
parent 5a00782b36
commit 27d14261fb
2 changed files with 34 additions and 1 deletions

View File

@ -6,7 +6,7 @@ source = ~/.config/hypr/config/defaults.conf
# Autostart wiki https://wiki.hyprland.org/0.45.0/Configuring/Keywords/#executing #
exec-once = waybar &
exec-once = /home/michaelb/.config/hypr/scripts/launch-waybar.sh &
exec-once = blueman-applet &
exec-once = fcitx5 -d &
exec-once = mako &

View File

@ -0,0 +1,33 @@
#!/bin/bash
# start waybar if not started
if ! pgrep -x "waybar" > /dev/null; then
waybar &
fi
# current checksums
current_checksum_config=$(md5sum ~/.config/waybar/config)
current_checksum_style=$(md5sum ~/.config/waybar/style.css)
current_checksum_colors=$(md5sum ~/.config/waybar/colors-wallust.css)
# loop forever
while true; do
# new checksums
new_checksum_config=$(md5sum ~/.config/waybar/config)
new_checksum_style=$(md5sum ~/.config/waybar/style.css)
new_checksum_colors==$(md5sum ~/.config/waybar/colors-wallust.css)
# if checksums are different
if [ "$current_checksum_config" != "$new_checksum_config" ] || [ "$current_checksum_style" != "$new_checksum_style" ] || [ "$current_checksum_colors" != "$new_checksum_colors" ]; then
# kill waybar
killall waybar
# start waybar
waybar &
# update checksums
current_checksum_config=$new_checksum_config
current_checksum_style=$new_checksum_style
current_checksum_colors=$new_checksum_colors
fi
done