Files
dotfiles/config/hypr/scripts/shader-cycle.sh
T

22 lines
477 B
Bash
Executable File

#!/bin/bash
SHADER_DIR="$HOME/.config/hypr/shaders"
mapfile -t SHADERS < <(find "$SHADER_DIR" -name "*.glsl" | sort)
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
NEXT=$(( (INDEX + 1) % ${#SHADERS[@]} ))
hyprshade on "${SHADERS[$NEXT]}"