Hyprland-dotfiles/hypr/scripts/hyprshade.sh

60 lines
1.8 KiB
Bash
Raw Normal View History

2024-05-15 11:42:32 -04:00
#!/bin/bash
2024-05-22 11:06:47 -04:00
# _ _ _ _
# | | | |_ _ _ __ _ __ ___| |__ __ _ __| | ___
# | |_| | | | | '_ \| '__/ __| '_ \ / _` |/ _` |/ _ \
# | _ | |_| | |_) | | \__ \ | | | (_| | (_| | __/
# |_| |_|\__, | .__/|_| |___/_| |_|\__,_|\__,_|\___|
# |___/|_|
#
if [[ "$1" == "rofi" ]]; then
# Open rofi to select the Hyprshade filter for toggle
# List all available shaders
option1="blue-light-filter"
option2="vibrance"
option3="invert-colors"
option4="off"
options="$option1\n"
options="$options$option2\n"
options="$options$option3\n$option4"
# Open rofi
choice=$(echo -e "$options" | rofi -dmenu -replace -config ~/dotfiles/rofi/config-hyprshade.rasi -i -no-show-icons -l 4 -width 30 -p "Hyprshade")
if [ ! -z $choice ] ;then
echo "hyprshade_filter=\"$choice\"" > ~/dotfiles/.settings/hyprshade.sh
dunstify "Changing Hyprshade to $choice" "Toggle shader with SUPER+SHIFT+S"
2024-05-15 11:42:32 -04:00
fi
2024-05-22 11:06:47 -04:00
2024-05-15 11:42:32 -04:00
else
2024-05-22 11:06:47 -04:00
# Toggle Hyprshade based on the selected filter
hyprshade_filter="blue-light-filter"
# Check if hyprshade.sh settings file exists and load
if [ -f ~/dotfiles/.settings/hyprshade.sh ] ;then
source ~/dotfiles/.settings/hyprshade.sh
fi
# Toggle Hyprshade
if [ "$hyprshade_filter" != "off" ] ;then
if [ -z $(hyprshade current) ] ;then
echo ":: hyprshade is not running"
hyprshade on $hyprshade_filter
echo ":: hyprshade started with $(hyprshade current)"
else
echo ":: Current hyprshade $(hyprshade current)"
echo ":: Switching hyprshade off"
hyprshade off
fi
else
if [ -z $(hyprshade current) ] ;then
hyprshade off
fi
echo ":: hyprshade turned off"
2024-05-15 11:42:32 -04:00
fi
2024-05-22 11:06:47 -04:00
2024-05-15 11:42:32 -04:00
fi