aboutsummaryrefslogtreecommitdiffstats
path: root/config/hypr/scripts
diff options
context:
space:
mode:
authorDon Williams <don.e.williams@gmail.com>2025-10-05 14:36:19 -0400
committerDon Williams <don.e.williams@gmail.com>2025-10-05 14:36:19 -0400
commit5c41160260900398b8f9440edf0c735946187e90 (patch)
tree25de05a1c376dd2294adb7bafa84797a833ef38f /config/hypr/scripts
parent0c5e7e9de06cc7e786974a3ee5b8e7bda517d219 (diff)
feat(hyprsunset): add Hyprsunset toggle script, SUPER+N keybind, and Waybar nightlight button across all layouts; include in status and vertical power groups
Diffstat (limited to 'config/hypr/scripts')
-rwxr-xr-xconfig/hypr/scripts/Hyprsunset.sh77
1 files changed, 77 insertions, 0 deletions
diff --git a/config/hypr/scripts/Hyprsunset.sh b/config/hypr/scripts/Hyprsunset.sh
new file mode 100755
index 00000000..68e5fab8
--- /dev/null
+++ b/config/hypr/scripts/Hyprsunset.sh
@@ -0,0 +1,77 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+# Hyprsunset toggle + Waybar status helper
+# Phase 1: manual toggle only (no scheduling)
+# Icons:
+# - Off: bright sun
+# - 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)
+
+STATE_FILE="$HOME/.cache/.hyprsunset_state"
+TARGET_TEMP="${HYPERSUNSET_TEMP:-4500}"
+ICON_MODE="${HYPERSUNSET_ICON_MODE:-sunset}"
+
+ensure_state() {
+ [[ -f "$STATE_FILE" ]] || echo "off" > "$STATE_FILE"
+}
+
+# Render icons using pango markup to allow colorization
+icon_off() {
+ # bright sun when not activated
+ printf "<span foreground='gold'></span>"
+}
+
+icon_on() {
+ case "$ICON_MODE" in
+ sunset)
+ printf "<span foreground='orange'></span>"
+ ;;
+ blue)
+ printf "<span foreground='deepskyblue'></span>"
+ ;;
+ *)
+ printf "<span foreground='orange'></span>"
+ ;;
+ esac
+}
+
+cmd_toggle() {
+ ensure_state
+ state="$(cat "$STATE_FILE" || echo off)"
+ if [[ "$state" == "on" ]]; then
+ if command -v hyprsunset >/dev/null 2>&1; then
+ hyprsunset -r || true
+ fi
+ echo off > "$STATE_FILE"
+ else
+ if command -v hyprsunset >/dev/null 2>&1; then
+ hyprsunset -t "$TARGET_TEMP" || true
+ fi
+ echo on > "$STATE_FILE"
+ fi
+}
+
+cmd_status() {
+ ensure_state
+ state="$(cat "$STATE_FILE" || echo off)"
+ if [[ "$state" == "on" ]]; then
+ txt="$(icon_on)"
+ cls="on"
+ tip="Night light on @ ${TARGET_TEMP}K"
+ else
+ txt="$(icon_off)"
+ cls="off"
+ tip="Night light off"
+ fi
+ printf '{"text":"%s","class":"%s","tooltip":"%s"}\n' "$txt" "$cls" "$tip"
+}
+
+case "${1:-}" in
+ toggle) cmd_toggle ;;
+ status) cmd_status ;;
+ *) echo "usage: $0 [toggle|status]" >&2; exit 2 ;;
+ esac
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage