Repository navigation
Rearm idle monitor after timeout changes - #9570
Conversation
|
Tested on my laptop (ASUS Vivobook, Intel Arc, omarchy 4.0.4, Quickshell 0.3.1). On stock, changing This also fixes #8038 and #12855. It might be worth switching |
Quickshell does replace the notification when the timeout changes: updateNotification() deletes it and creates a new one. The failure is that the replacement can land at the deleted one's address, so Qt sees bNotification unchanged and isIdle never subscribes to the replacement. Disabling first sends the pointer through null, which is why the pulse works. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Codex Medium <noreply@openai.com>
[Medium impact] The PR appears safe to merge; the remaining runtime-test gap is non-blocking. Findings
SummaryUpdates the idle service to re-arm
No new actionable issues were established.
|
| assert( | ||
| /onFirstIdleTimeoutSecondsChanged:[\s\S]*?idleMonitorRearmTimer\.restart\(\)/.test(serviceSource), | ||
| 'idle re-arms its monitor when the configured first timeout changes' | ||
| ) | ||
|
|
||
| const idleMonitor = serviceSource.slice(serviceSource.indexOf(' IdleMonitor {')) | ||
| .split('\n }', 1)[0] | ||
| assert( | ||
| /enabled: root\.idleEnabled && !idleMonitorRearmTimer\.running/.test(idleMonitor), | ||
| 'idle monitor stays disabled for the re-arm timer turn' | ||
| ) | ||
|
|
||
| const rearmTimer = serviceSource.slice(serviceSource.indexOf(' id: idleMonitorRearmTimer')) | ||
| .split('\n }', 1)[0] | ||
| assert(/interval: 150/.test(rearmTimer), 'idle re-arm spans a tested event-loop delay') | ||
| assert(/repeat: false/.test(rearmTimer), 'idle re-arm only pulses the monitor once per timeout change') |
There was a problem hiding this comment.
These assertions match QML source text but never change a timeout in a running IdleMonitor. They can pass even if idle notifications fail to resume, so the reported regression has no behavioral test coverage.
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!
|
Reviewed at ef82132 and run on a stock Omarchy worker VM built from the ISO, with each tree linked as the running shell, The bug reproduces and this fixes it. On I pushed one commit, ef82132, which corrects the code comment. Quickshell does replace the notification when the timeout changes: Linked issue. #9496 was closed as a duplicate of #8038, so I linked #8038 to this pull request so that it closes when this merges. #12855 includes this trigger, but it also reports idle stopping with no timeout edit (after a restart and after resume). I have not seen this change fix that, so it is not linked. Compared with the other open fixes for the same bug, this is the smallest and the most targeted. #8086 cancels a running idle cycle whenever either timeout changes, even when the monitor's own timeout stays the same. #12731 builds no monitor when the shortest timeout is 0, which One note on the tests: the new assertions in The second opinion came from Codex at medium effort, over two rounds. It found no runtime defect and agreed with the address-reuse explanation; independence is not guaranteed, since it can read this session's reasoning. It also tightened the wording of the corrected comment and pointed out the source-shape tests, both covered above. This now waits on the maintainer. |
quattro now keeps the idle monitor off while both timeouts are 0 and clamps its timeout to at least a second; the monitor stays off for the re-arm pulse on top of that. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
This had stopped merging cleanly, because Re-verified at 3bd9d87 on a stock Omarchy worker VM built from the ISO, with each tree running as the shell, One behaviour for the maintainer to weigh. Greptile's comment on line 260 is right in one narrow case, and I reproduced it on the worker. When the screensaver is toggled off ( The source-shape assertions in Competing fixes. #8086 is older, but it cancels a running idle cycle whenever either timeout changes, even when the monitor's own timeout stays the same. That undoes The second opinion came from Codex at medium effort. It found the screensaver-off case above, which I then reproduced on the worker. It agreed the merge resolution keeps This is verified and now waits on the maintainer's call on the screensaver-off trade-off. |
quattro dropped the idle test's source-text assertions (omacom#16334), and its AGENTS.md now rules out tests that grep the source, so the resolution takes quattro's idle-test.sh and drops this branch's regex checks of the re-arm timer with them. Service.qml merged cleanly.
Since quattro's idle service closes the screensaver and cancels the cycle on any active signal past the launch grace, the re-arm pulse fired mid-cycle read as the user returning: a shell.json timeout change while the screensaver was up closed it, ran omarchy-system-wake and pushed the lock back by the time already spent idle. Ignoring the pulse's active signal instead would leave a user who then comes back unseen, since the fresh notification starts out active and can only report a return after it first idles. So the monitor's timeout is no longer bound. It is set, and pulsed, only while the monitor reports active: straight away when the user is at the machine, as when they edit shell.json, and otherwise on the return that ends the cycle. Until then the running cycle keeps its notification, so it still sees the return and keeps its deadlines. Co-Authored-By: Codex Medium <noreply@openai.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
This had stopped merging cleanly again: The merge made the mid-cycle trade-off from my last comment worse, so I pushed a fix, 23409f3. With So the monitor's Verified at 23409f3 on a stock Omarchy worker VM built from the ISO (Quickshell 0.3.2), with each tree linked as the running shell and no input unless stated:
One thing for you: the description no longer matches the change. It describes the pulse without the wait while idle, and its test plan lists test assertions that Competing fixes are unchanged from last time. #8086 is older, but it cancels a running idle cycle on any timeout change, which undoes The second opinion came from Codex at medium effort and muse-wonder via pi at high thinking, over two rounds. In the first round both confirmed that the merge kept This is verified. Once the description is updated, it waits on the maintainer. |
quattro's idle service gained retimeIdleMonitor() (#9570) at the spot where lockCommandPending was declared. Both stay; the property moves down beside the rest of the service's state. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
* Rearm idle monitor after timeout changes * Correct why the idle monitor needs re-arming Quickshell does replace the notification when the timeout changes: updateNotification() deletes it and creates a new one. The failure is that the replacement can land at the deleted one's address, so Qt sees bNotification unchanged and isIdle never subscribes to the replacement. Disabling first sends the pointer through null, which is why the pulse works. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Codex Medium <noreply@openai.com> * Retime the idle monitor only once the user is back Since quattro's idle service closes the screensaver and cancels the cycle on any active signal past the launch grace, the re-arm pulse fired mid-cycle read as the user returning: a shell.json timeout change while the screensaver was up closed it, ran omarchy-system-wake and pushed the lock back by the time already spent idle. Ignoring the pulse's active signal instead would leave a user who then comes back unseen, since the fresh notification starts out active and can only report a return after it first idles. So the monitor's timeout is no longer bound. It is set, and pulsed, only while the monitor reports active: straight away when the user is at the machine, as when they edit shell.json, and otherwise on the return that ends the cycle. Until then the running cycle keeps its notification, so it still sees the return and keeps its deadlines. Co-Authored-By: Codex Medium <noreply@openai.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Omarchybot <317366263+omarchybot@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Codex Medium <noreply@openai.com> Co-authored-by: David Heinemeier Hansson <david@hey.com> (cherry picked from commit c5f98c6)
Summary
Re-arm Quickshell's
IdleMonitorwhen a liveshell.jsonedit changes the effective first idle timeout.Changing
idle.screensaveroridle.lockupdates the QML timeout immediately, but affected Quickshell sessions can leave the underlying Wayland idle notification silent. The shell then reports the new values while screensaver, lock, and display-idle events never fire until a restart.The idle service now pulses the monitor off for 150 ms and declaratively re-enables it with the new timeout. This spans the event-loop delay validated in the issue reproduction, remains gated by Stay Awake, coalesces rapid edits by restarting the one-shot timer, and exposes the re-arm state in idle diagnostics.
Closes #9496
Test plan
bash test/shell.d/idle-test.sh/usr/lib/qt6/bin/qmllint -I /usr/lib/qt6/qml -I shell shell/plugins/services/idle/Service.qml(only existingQProcess::ExitStatusimport warnings)./test/shell(changed test passes; suite retains five unrelated baseline failures: three require anomarchy-pkgscheckout, plus the existing launch-about and network-QR assertions)Fixes #8038