aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorDon Williams <don.e.williams@gmail.com>2025-10-05 14:53:46 -0400
committerDon Williams <don.e.williams@gmail.com>2025-10-05 14:53:46 -0400
commit4b2fb9ebeb2abaeb52f24ed4889801b36cbb2ba9 (patch)
treeb8d193affafda74ab0808bd85c61fe409219c3d2 /config
parent5c41160260900398b8f9440edf0c735946187e90 (diff)
fix(hyprsunset): support hyprsunset v0.3.x (-i instead of -r), avoid CTM conflicts, run in background, process-based status
Diffstat (limited to 'config')
-rwxr-xr-xconfig/hypr/scripts/Hyprsunset.sh26
1 files changed, 22 insertions, 4 deletions
diff --git a/config/hypr/scripts/Hyprsunset.sh b/config/hypr/scripts/Hyprsunset.sh
index 68e5fab8..0de19d44 100755
--- a/config/hypr/scripts/Hyprsunset.sh
+++ b/config/hypr/scripts/Hyprsunset.sh
@@ -42,14 +42,26 @@ icon_on() {
cmd_toggle() {
ensure_state
state="$(cat "$STATE_FILE" || echo off)"
+
+ # Always stop any running hyprsunset first to avoid CTM manager conflicts
+ if pgrep -x hyprsunset >/dev/null 2>&1; then
+ pkill -x hyprsunset || true
+ # give it a moment to release the CTM manager
+ sleep 0.2
+ fi
+
if [[ "$state" == "on" ]]; then
+ # Turning OFF: set identity and exit
if command -v hyprsunset >/dev/null 2>&1; then
- hyprsunset -r || true
+ nohup hyprsunset -i >/dev/null 2>&1 &
+ # if hyprsunset persists, stop it shortly after applying identity
+ sleep 0.3 && pkill -x hyprsunset || true
fi
echo off > "$STATE_FILE"
else
+ # Turning ON: start hyprsunset at target temp in background
if command -v hyprsunset >/dev/null 2>&1; then
- hyprsunset -t "$TARGET_TEMP" || true
+ nohup hyprsunset -t "$TARGET_TEMP" >/dev/null 2>&1 &
fi
echo on > "$STATE_FILE"
fi
@@ -57,8 +69,14 @@ cmd_toggle() {
cmd_status() {
ensure_state
- state="$(cat "$STATE_FILE" || echo off)"
- if [[ "$state" == "on" ]]; then
+ # Prefer live process detection; fall back to state file
+ if pgrep -x hyprsunset >/dev/null 2>&1; then
+ onoff="on"
+ else
+ onoff="$(cat "$STATE_FILE" || echo off)"
+ fi
+
+ if [[ "$onoff" == "on" ]]; then
txt="$(icon_on)"
cls="on"
tip="Night light on @ ${TARGET_TEMP}K"
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage