fix: shader-cycle nutzt .active-Datei statt fragiler hyprctl-Erkennung
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#!/bin/bash
|
||||
SHADER_DIR="$HOME/.config/hypr/shaders"
|
||||
ACTIVE_FILE="$SHADER_DIR/.active"
|
||||
|
||||
mapfile -t SHADERS < <(find "$SHADER_DIR" -name "*.glsl" | sort)
|
||||
|
||||
@@ -7,15 +8,9 @@ if [[ ${#SHADERS[@]} -eq 0 ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
CURRENT=$(hyprctl getoption decoration:screen_shader | grep "str:" | awk '{print $2}' | tr -d '"')
|
||||
|
||||
INDEX=-1
|
||||
for i in "${!SHADERS[@]}"; do
|
||||
if [[ "${SHADERS[$i]}" == "$CURRENT" ]]; then
|
||||
INDEX=$i
|
||||
break
|
||||
fi
|
||||
done
|
||||
INDEX=$(cat "$ACTIVE_FILE" 2>/dev/null)
|
||||
[[ "$INDEX" =~ ^[0-9]+$ ]] || INDEX=-1
|
||||
|
||||
NEXT=$(( (INDEX + 1) % ${#SHADERS[@]} ))
|
||||
echo "$NEXT" > "$ACTIVE_FILE"
|
||||
hyprshade on "${SHADERS[$NEXT]}"
|
||||
|
||||
Reference in New Issue
Block a user