#!/usr/bin/env bash # This script allows toggling the active screen_shader used in hyprland. # It automatically discovers shader files in the $SHADERDIR folder. # And uses rofi for a graphical gui-- this uses the shaders.rasi configuration file. # (Also dunst for notifications.) SHADERDIR="$HOME/.config/hypr/windowShaders/" function dunst() { dunstify \ -r 2137 \ -t 2000 \ -u low \ -i ~/.icons/candy-icons/apps/scalable/applets-screenshooter.svg \ "${1/.*/}" } shaders="reset, $(find "$SHADERDIR" -type f,l -regextype posix-extended -iregex '.*(frag|vert|glsl)$' | awk -F'[./]' '{printf "%s,%s.%s\n", $(NF-1), $(NF-1), $NF}')" idx=$(printf "%s" "$shaders" | awk -F',' '{print $1}' | rofi -i -dmenu -P Shaders -config ~/.config/rofi/shaders.rasi -format d) # apply selected shader (if any) if [[ $idx -eq 0 ]]; then printf "No shader selected.\nExiting..\n" exit fi if [[ $idx -eq 1 ]]; then # selected reset, which is a special case hyprctl dispatch 'hl.dsp.window.clear_tags()' hyprctl reload dunst "Reset shader" exit fi name=$(printf "%s" "$shaders" | awk -F',' "NR == $idx {printf \"%s\n\", \$1}") hyprctl dispatch "hl.dsp.window.tag({ tag = 'shader/$name'})" dunst "Applied shader $file"