Repository navigation
Start hyprsunset for the current user when toggling nightlight #14041
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: quattro
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,7 @@ trap 'rm -rf "$TMPDIR"' EXIT | |
| mkdir -p "$TMPDIR/bin" | ||
| STATE="$TMPDIR/hyprsunset-temp" | ||
| SHELL_LOG="$TMPDIR/omarchy-shell-log" | ||
| PGREP_LOG="$TMPDIR/pgrep-log" | ||
|
|
||
| cat >"$TMPDIR/bin/hyprctl" <<'SH' | ||
| #!/bin/bash | ||
|
|
@@ -39,6 +40,7 @@ SH | |
|
|
||
| cat >"$TMPDIR/bin/pgrep" <<'SH' | ||
| #!/bin/bash | ||
| printf '%s\n' "$*" >>"$PGREP_LOG" | ||
| exit 0 | ||
|
Comment on lines
+43
to
44
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! |
||
| SH | ||
|
|
||
|
|
@@ -53,6 +55,7 @@ nightlight_cli() { | |
| PATH="$TMPDIR/bin:$PATH" \ | ||
| HYPRSUNSET_STATE="$STATE" \ | ||
| OMARCHY_SHELL_LOG="$SHELL_LOG" \ | ||
| PGREP_LOG="$PGREP_LOG" \ | ||
| "$ROOT/bin/omarchy-toggle-nightlight" "$@" | ||
| } | ||
|
|
||
|
|
@@ -82,6 +85,9 @@ pass "nightlight toggle warms the screen from daylight" | |
| grep -Fqx -- '-q nightlight refresh' "$SHELL_LOG" || fail "nightlight toggle nudges the shell nightlight service" | ||
| pass "nightlight toggle nudges the shell nightlight service" | ||
|
|
||
| grep -Fqx -- "-u $USER -x hyprsunset" "$PGREP_LOG" || fail "nightlight toggle only looks for the current user's hyprsunset" | ||
| pass "nightlight toggle only looks for the current user's hyprsunset" | ||
|
|
||
| nightlight_cli >/dev/null | ||
| [[ $(<"$STATE") == 6500 ]] || fail "nightlight toggle restores daylight from night light" | ||
| pass "nightlight toggle restores daylight from night light" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
USERis unset,pgrepfails and the toggle tries to start another hyprsunset even when one is running. If it names another logged-in user, that user's process can prevent the current user's daemon from starting. Use the running UID for this check.