adds waybar reload on config change
This commit is contained in:
		@@ -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 &
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										33
									
								
								.config/hypr/scripts/launch-waybar.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										33
									
								
								.config/hypr/scripts/launch-waybar.sh
									
									
									
									
									
										Executable 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
 | 
			
		||||
		Reference in New Issue
	
	Block a user