diff options
| author | Alberson Miranda <45690517+albersonmiranda@users.noreply.github.com> | 2025-11-08 00:17:21 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-08 12:17:21 +0900 |
| commit | 672aaf336df2a4897c086d84da6fea8611a5ec54 (patch) | |
| tree | 895e5c13376cbc0e7800f09b13be106f5fd37450 | |
| parent | 1788691d242abe607add69d211478e306a154cc6 (diff) | |
feat: resume hyprsunset (#862)
Looks good! Merging this into development branch 👍
| -rw-r--r-- | config/hypr/configs/Startup_Apps.conf | 2 | ||||
| -rwxr-xr-x | config/hypr/scripts/Hyprsunset.sh | 22 |
2 files changed, 19 insertions, 5 deletions
diff --git a/config/hypr/configs/Startup_Apps.conf b/config/hypr/configs/Startup_Apps.conf index 07a92a3f..c1670595 100644 --- a/config/hypr/configs/Startup_Apps.conf +++ b/config/hypr/configs/Startup_Apps.conf @@ -48,6 +48,8 @@ exec-once = $UserScripts/RainbowBorders.sh # Starting hypridle to start hyprlock exec-once = hypridle +# Resume Hyprsunset if state is "on" from previous session +exec-once = $scriptsDir/Hyprsunset.sh init # Here are list of features available but disabled by default # exec-once = swww-daemon --format xrgb && swww img $HOME/Pictures/wallpapers/mecha-nostalgia.png # persistent wallpaper 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 |
