fix: shader-cycle nutzt .active-Datei statt fragiler hyprctl-Erkennung

This commit is contained in:
2026-04-23 21:11:49 +02:00
parent d3c70b0f84
commit 0beb72ab15
2 changed files with 5 additions and 9 deletions
+1
View File
@@ -3,3 +3,4 @@ config/hypr/colors.conf
config/waybar/style.css config/waybar/style.css
config/wofi/style.css config/wofi/style.css
config/hypr/hyprpaper.conf config/hypr/hyprpaper.conf
config/hypr/shaders/.active
+4 -9
View File
@@ -1,5 +1,6 @@
#!/bin/bash #!/bin/bash
SHADER_DIR="$HOME/.config/hypr/shaders" SHADER_DIR="$HOME/.config/hypr/shaders"
ACTIVE_FILE="$SHADER_DIR/.active"
mapfile -t SHADERS < <(find "$SHADER_DIR" -name "*.glsl" | sort) mapfile -t SHADERS < <(find "$SHADER_DIR" -name "*.glsl" | sort)
@@ -7,15 +8,9 @@ if [[ ${#SHADERS[@]} -eq 0 ]]; then
exit 0 exit 0
fi fi
CURRENT=$(hyprctl getoption decoration:screen_shader | grep "str:" | awk '{print $2}' | tr -d '"') INDEX=$(cat "$ACTIVE_FILE" 2>/dev/null)
[[ "$INDEX" =~ ^[0-9]+$ ]] || INDEX=-1
INDEX=-1
for i in "${!SHADERS[@]}"; do
if [[ "${SHADERS[$i]}" == "$CURRENT" ]]; then
INDEX=$i
break
fi
done
NEXT=$(( (INDEX + 1) % ${#SHADERS[@]} )) NEXT=$(( (INDEX + 1) % ${#SHADERS[@]} ))
echo "$NEXT" > "$ACTIVE_FILE"
hyprshade on "${SHADERS[$NEXT]}" hyprshade on "${SHADERS[$NEXT]}"