[theme-changer] Add support for multiple monitors.

This commit is contained in:
Viyurz 2024-08-06 18:09:31 +02:00
parent effcf89347
commit 26472739be
Signed by: Viyurz
SSH key fingerprint: SHA256:IskOHTmhHSJIvAt04N6aaxd5SZCVWW1Guf9tEcxIMj8

View file

@ -177,15 +177,22 @@ function set_betterdiscord_theme {
function set_desktop_wallpaper_theme {
if ! pgrep -u "$USER" hyprpaper > /dev/null; then
hyprctl dispatch exec hyprpaper > /dev/null
while ! hyprctl hyprpaper listloaded &> /dev/null; do
sleep 0.25
hyprctl -q dispatch exec hyprpaper
while ! hyprctl -q hyprpaper listloaded; do
sleep 0.1
done
fi
hyprctl hyprpaper preload "$wallpaper"
hyprctl hyprpaper wallpaper "eDP-1,$wallpaper"
hyprctl hyprpaper unload unused
for monitor in $(hyprctl -j monitors | jq -r '.[] | .name'); do
hyprctl -q hyprpaper preload "$wallpaper"
hyprctl -q hyprpaper wallpaper "$monitor,$wallpaper"
if [[ -n $albums_arg ]]; then
# Sets global variable $wallpaper
pick_random_wallpaper
fi
done
hyprctl -q hyprpaper unload unused
}
@ -202,7 +209,7 @@ function set_hyprland_theme {
echo '$'"$key=$value" >> "$HOME/.config/hypr/hyprland.d/colors.conf"
done
hyprctl reload > /dev/null
hyprctl -q reload
}
@ -245,7 +252,7 @@ function set_mako_theme {
if pgrep -u "$USER" mako > /dev/null; then
makoctl reload
else
hyprctl dispatch exec mako > /dev/null
hyprctl -q dispatch exec mako
fi
}
@ -279,7 +286,7 @@ function set_waybar_theme {
if pgrep -u "$USER" waybar > /dev/null; then
killall -SIGUSR2 waybar
else
hyprctl dispatch exec waybar > /dev/null
hyprctl -q dispatch exec waybar
fi
}