Skip to content

Re-arm idle monitor when timeouts change in shell.json (#8038) - #8086

Closed
askadityapandey wants to merge 2 commits into
omacom:quattrofrom
askadityapandey:fix-idle-timeout-rearm
Closed

askadityapandey wants to merge 2 commits into
omacom:quattrofrom
askadityapandey:fix-idle-timeout-rearm

Conversation

@askadityapandey

Copy link
Copy Markdown

Summary

Fixes #8038.

When a user modifies idle.screensaver or idle.lock timeouts in ~/.config/omarchy/shell.json on a running session, firstIdleTimeoutSeconds updates reactively. However, Quickshell's Wayland IdleMonitor does not automatically re-register the compositor's ext-idle-notify listener unless the monitor is re-armed. This left the session with an idle monitor that reports enabled: true in diagnostics but never receives idle notifications, causing the session to stay unlocked indefinitely.

Changes Made

  • Re-arm on Timeout Change: Added property bool monitorArmed: true bound to IdleMonitor { enabled: root.idleEnabled && root.monitorArmed }.
  • Dynamic Lifecycle Reset: Added onFirstIdleTimeoutSecondsChanged:
    • Cancels any active idle cycle if timeouts change mid-cycle (cancelIdleCycle("timeout-change")).
    • Cycles monitorArmed via Qt.callLater to force Quickshell to tear down the old listener and register the new timeout with the Wayland compositor.
    • Emits idle-timeout-rearm event log with the updated screensaver and lock timeouts for journal diagnostic tracking.

Verification

  • Ran ./test/shell.d/idle-test.sh — all 9 test assertions passed.
  • Verified that property bindings and event handlers adhere to repository QML style conventions.

Copilot AI balanced review requested due to automatic review settings August 24, 2026 18:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Re-arms the Wayland idle monitor after relevant timeout changes to prevent idle-lock failures.

Changes:

  • Adds monitor arm-state tracking.
  • Cancels active idle cycles and re-registers the monitor.
  • Logs timeout re-arm events.

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread shell/plugins/services/idle/Service.qml Resolved
@omarchybot omarchybot added the bug Something isn't working label Sep 27, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Thanks for taking this on. The bug in #8038 is real and several people have confirmed it. #9570 fixes the same bug in a different way, and it is the one I'd bring forward, so this one is left for the maintainer to decide between the two.

Why #9570: both PRs re-arm the monitor by switching enabled off and back on. This one switches it back on with Qt.callLater; #9570 keeps it off for a 150 ms Timer. The reporter of #9496 (closed as a duplicate of #8038) built a standalone Quickshell repro and says the pulse only re-arms the monitor if the off state lasts across an event-loop turn. They say Qt.callLater was not enough (the monitor still never fired) and a short Timer was. On #8038, @voglster traced the cause to Quickshell's IdleMonitor: the new notification is allocated at the old one's address, so nothing re-subscribes to it. That explains why a pulse that ends too quickly does nothing. #9570 also only fires when the effective first timeout (firstIdleTimeoutSeconds) actually changes, where this PR also re-arms when only the longer of the two timeouts moves. #9570 also skips the re-arm while Stay Awake is on, and it adds assertions to test/shell.d/idle-test.sh. This PR's own verification was idle-test.sh, which never exercises IdleMonitor, so it cannot show whether the pulse works.

One more difference: handleIdleTimeoutsChanged calls cancelIdleCycle("timeout-change"), which runs omarchy-system-wake and dismisses a screensaver that is already up whenever shell.json is written during an idle cycle. #9570 leaves a running cycle alone.

What was checked: I read both diffs against quattro and the idle service around them, along with the discussion on #8038 and #9496. Nothing was run. I did not test this PR on a worker, because it lost the comparison with #9570. The Qt.callLater finding comes from the reporter's test, not from mine.

Second opinion: none. The configured reviewer (Codex Medium) responded to a ping, but it refused this review because the day's review budget was spent, so this comparison is one model's reading.

Waiting on: the maintainer, who decides between this PR and #9570.

@omarchybot

Copy link
Copy Markdown
Collaborator

Closing in favour of #9570, which landed the fix for #8038: it re-arms the idle monitor when the first idle timeout changes, and waits until the user is back before retiming, so a change made while idle can't read as the user returning. Thanks for working on this.

Reviewed by Claude Opus 5.5 with Codex Medium as a second opinion; its independence is not guaranteed.

@omarchybot omarchybot closed this Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Changing idle.screensaver / idle.lock in shell.json silently kills the idle monitor until the shell is restarted

3 participants