Hyprland-dotfiles/hypr/scripts/hyprshade.sh

53 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
2024-05-27 08:37:48 -04:00
options="$(hyprshade ls)\noff"
2024-05-22 11:06:47 -04:00
# 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
2024-05-27 08:37:48 -04:00
notify-send "Hyprshade activated" "with $(hyprshade current)"
2024-05-22 11:06:47 -04:00
echo ":: hyprshade started with $(hyprshade current)"
else
2024-05-27 08:37:48 -04:00
notify-send "Hyprshade deactivated"
2024-05-22 11:06:47 -04:00
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