aboutsummaryrefslogtreecommitdiffstats
path: root/config/hypr/scripts/Hyprsunset.sh
diff options
context:
space:
mode:
authorMartin Guzman <55927935+brockar@users.noreply.github.com>2025-11-22 13:42:39 -0300
committerGitHub <noreply@github.com>2025-11-22 13:42:39 -0300
commitbcfd5e7c2b67f0a62b1ceeb62d20b0a80ca55a70 (patch)
treee87f649fe0c9d8f382b8f465d1468b6495fb5886 /config/hypr/scripts/Hyprsunset.sh
parentc862835221decf03b6640bb43e4044861cceaa04 (diff)
parent1351220a092414ae593bc006e3a3ebc09523198d (diff)
Merge pull request #871 from JaKooLit/development
[Bug] Change to waybar sleep timers was too long, slowed down waybar start/refressh
Diffstat (limited to 'config/hypr/scripts/Hyprsunset.sh')
-rwxr-xr-xconfig/hypr/scripts/Hyprsunset.sh22
1 files changed, 17 insertions, 5 deletions
diff --git a/config/hypr/scripts/Hyprsunset.sh b/config/hypr/scripts/Hyprsunset.sh
index c7c4b395..4a2b52f4 100755
--- a/config/hypr/scripts/Hyprsunset.sh
+++ b/config/hypr/scripts/Hyprsunset.sh
@@ -8,12 +8,12 @@ set -euo pipefail
# - On: sunset icon if available, otherwise a blue sun
#
# Customize via env vars:
-# HYPERSUNSET_TEMP default 4500 (K)
-# HYPERSUNSET_ICON_MODE sunset|blue (default: sunset)
+# HYPRSUNSET_TEMP default 4500 (K)
+# HYPRSUNSET_ICON_MODE sunset|blue (default: sunset)
STATE_FILE="$HOME/.cache/.hyprsunset_state"
-TARGET_TEMP="${HYPERSUNSET_TEMP:-4500}"
-ICON_MODE="${HYPERSUNSET_ICON_MODE:-sunset}"
+TARGET_TEMP="${HYPRSUNSET_TEMP:-4500}"
+ICON_MODE="${HYPRSUNSET_ICON_MODE:-sunset}"
ensure_state() {
[[ -f "$STATE_FILE" ]] || echo "off" > "$STATE_FILE"
@@ -92,8 +92,20 @@ cmd_status() {
printf '{"text":"%s","class":"%s","tooltip":"%s"}\n' "$txt" "$cls" "$tip"
}
+cmd_init() {
+ ensure_state
+ state="$(cat "$STATE_FILE" || echo off)"
+
+ if [[ "$state" == "on" ]]; then
+ if command -v hyprsunset >/dev/null 2>&1; then
+ nohup hyprsunset -t "$TARGET_TEMP" >/dev/null 2>&1 &
+ fi
+ fi
+}
+
case "${1:-}" in
toggle) cmd_toggle ;;
status) cmd_status ;;
- *) echo "usage: $0 [toggle|status]" >&2; exit 2 ;;
+ init) cmd_init ;;
+ *) echo "usage: $0 [toggle|status|init]" >&2; exit 2 ;;
esac
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage