Files
Arch_Hyprland_dots/.config/scripts/hyprshade-auto.sh
T

44 lines
928 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
STATE_FILE="$HOME/.config/scripts/hyprshade-toggle-state"
SHADER="$HOME/.config/scripts/night_screen.frag"
HOUR=$(date +%H)
ARG="$1"
if [ ! -f "$STATE_FILE" ]; then
echo 0 > "$STATE_FILE" || exit 1
chmod 600 "$STATE_FILE"
fi
STATE=$(cat "$STATE_FILE")
case "$STATE" in
0)
if [ "$ARG" = "time" ]; then
echo "night_mode controlled"
# DEFAULT (AUTO)
if [ "$HOUR" -ge 19 ] || [ "$HOUR" -lt 7 ]; then
hyprshade on "$SHADER"
else
hyprshade off
fi
else
echo "Default (auto) mod"
echo 1 > "$STATE_FILE"
fi
;;
1)
# KAPALI
hyprshade off
echo "Kapalı mod"
echo 2 > "$STATE_FILE"
;;
2)
# HEP AÇIK
hyprshade on "$SHADER"
echo "Hep açık mod"
echo 0 > "$STATE_FILE"
;;
esac