Repository navigation
Conversation
The toggle checked for any hyprsunset process, so another logged-in user's instance kept it from starting one for this session, and the toggle silently did nothing. Fixes omacom#14037 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
| # Ensure hyprsunset is running | ||
| if ! pgrep -x hyprsunset >/dev/null; then | ||
| # Ensure hyprsunset is running in this session (another user may have their own) | ||
| if ! pgrep -u "$USER" -x hyprsunset >/dev/null; then |
There was a problem hiding this comment.
Environment user can misidentify processes. If
USER is unset, pgrep fails 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.
| if ! pgrep -u "$USER" -x hyprsunset >/dev/null; then | |
| if ! pgrep -u "$(id -u)" -x hyprsunset >/dev/null; then |
| printf '%s\n' "$*" >>"$PGREP_LOG" | ||
| exit 0 |
There was a problem hiding this comment.
Startup branch remains untested. The
pgrep stub always reports that a process exists, while the new assertion checks only the arguments passed to it. The test therefore cannot catch a failure to start hyprsunset when only another user has one running. Model that case in the stub and assert that startup occurs.
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!
|
Thanks for the fix! Heads up that #14038 (opened about 20 minutes earlier for the same issue, #14037) covers the toggle too and also the second copy of this check in Small difference between the two: #14038 uses |
|
Thanks for this, @nickolss. The cause is right: Three open pull requests fix #14037: #14038 (opened about 20 minutes before this one), this one, and #14530. #14038 is the one going forward. It is older, which wins by default, and it also covers two places this one leaves unscoped:
#14038 also uses Checked by reading the three diffs against current |
Fixes #14037
omarchy-toggle-nightlightchecked for hyprsunset withpgrep -x hyprsunset, which matches processes from every user. If another user on the machine has a Hyprland session with hyprsunset running, the toggle never starts one for the current session. Thenhyprctl hyprsunset temperaturecan't reach a socket and the toggle silently does nothing.This limits the check to the current user with
pgrep -u "$USER" -x hyprsunset.Testing
test/shell.d/nightlight-test.shthat the toggle only looks for the current user's hyprsunset. It fails without the fix and passes with it../test/allhas the same 11 failures before and after this change on my machine. All of them are environment-related (vscode theme, omarchy-pkgs checkout, browser launcher, etc.) and none are in the nightlight tests.🤖 Generated with Claude Code