From 710f39d75293c34f8a39b875d1d33fdde6e0a5c0 Mon Sep 17 00:00:00 2001 From: zaske Date: Thu, 7 Aug 2025 15:02:48 +0200 Subject: [PATCH] added waybar scripts --- Waybar/scripts/wallpaper_switch.sh | 37 ++++++++++++++++++++++++++++++ get_configs.sh | 1 + 2 files changed, 38 insertions(+) create mode 100755 Waybar/scripts/wallpaper_switch.sh diff --git a/Waybar/scripts/wallpaper_switch.sh b/Waybar/scripts/wallpaper_switch.sh new file mode 100755 index 0000000..c2f32b8 --- /dev/null +++ b/Waybar/scripts/wallpaper_switch.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +# Aktives Wallpaper ermitteln +active=$(hyprctl hyprpaper listactive | grep -E '^[^[:space:]]+ =' | cut -d'=' -f2 | xargs) + +echo $active +# Geladene Wallpaper extrahieren +output=$(hyprctl hyprpaper listloaded) +wallpapers=() + +while IFS= read -r line; do + path=$(echo "$line" | cut -d',' -f2 | xargs) + wallpapers+=("$path") +done <<<"$output" + +# Aktives Wallpaper im Array suchen +active_index=-1 +for i in "${!wallpapers[@]}"; do + echo ${wallpapers[$i]} + if [[ "${wallpapers[$i]}" == "$active" ]]; then + active_index=$i + break + fi +done + +# Nächstes Wallpaper setzen +echo nächstes WP= $wallpapers[$next_index] +if [[ $active_index -ge 0 ]]; then + next_index=$(((active_index + 1) % ${#wallpapers[@]})) + next_wallpaper="${wallpapers[$next_index]}" + echo nächstes WP = $next_wallpaper + hyprctl hyprpaper wallpaper "eDP-1, $next_wallpaper" + wal -i $next_wallpaper + pkill -SIGUSR2 waybar +else + echo "Aktives Wallpaper wurde nicht gefunden." +fi diff --git a/get_configs.sh b/get_configs.sh index 4b03317..e0cf623 100644 --- a/get_configs.sh +++ b/get_configs.sh @@ -17,6 +17,7 @@ copy ~/.config/hypr/hyprland.conf ./Hyprland #waybar copy ~/.config/waybar/style.css ./Waybar copy ~/.config/waybar/config.jsonc ./Waybar +cp -rv ~/.config/waybar/scripts/ ./Waybar/ #rsync ~/.config/waybar/frappe.css ./Waybar