Repository navigation
fix(quickCapture): keep deferred menu actions in daemon context - #38
Conversation
Reviewer's GuideFixes Quick Capture screenshot and recording actions by capturing all required arguments and scheduling deferred work from the persistent daemon rather than destroyed popout content. Sequence diagram for deferred Quick Capture dispatchsequenceDiagram
actor User
participant Menu as CaptureLauncherModal
participant Daemon as QuickCaptureDaemon
participant Qt
participant Capture as CaptureOrRecord
User->>Menu: Select screenshot or recording action
Menu->>Daemon: captureFromMenu(mode, action, outputName, widget)
Menu->>Daemon: recordFromMenu(mode, widget)
Daemon->>Menu: widget.closePopout()
Daemon->>Qt: Qt.callLater(callback)
Note over Qt,Capture: Callback runs from persistent daemon context
Qt->>Daemon: root.capture(mode, action, outputName, false)
Qt->>Daemon: root.record(mode, "", false)
Daemon->>Capture: Start requested capture or recording
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Caution Review failedThe pull request is closed. No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="quickCapture/components/bar/CaptureLauncherModal.qml" line_range="87" />
<code_context>
if (!root.daemon)
return;
- root.widget.runAfterPopoutClosed(() => root.daemon.capture(mode, action, outputName));
+ root.daemon.captureFromMenu(mode, action, outputName, root.widget);
+ }
+
</code_context>
<issue_to_address>
**Bar popout actions never start**
When a screenshot or recording is selected from the bar widget’s popout rather than the centered modal, `CaptureMenu.run` and its recording delegate defer callbacks that dereference the destroyed menu’s `root` or `modelData`, so the daemon never receives the action and capture or recording does not start.
Have `CaptureMenu.run` and the recording delegate call the daemon’s menu-action methods instead of deferring callbacks that capture the menu’s `root` or `modelData`.
Also at `quickCapture/components/bar/CaptureLauncherModal.qml:816-817`, `quickCapture/QuickCaptureDaemon.qml:96-99`, `quickCapture/QuickCaptureDaemon.qml:101-104`.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 1 finding to address first, and if the deferred call uses the wrong mode or arguments, it could create an unintended capture or recording file. Reverting stops future calls but does not remove files already created; those are bounded and can be deleted.
Blocking findings: quickCapture/components/bar/CaptureLauncherModal.qml:87
|
Thanks for your PR. |
What
Fix screenshot and recording actions launched from both Quick Capture menus: the centered
CaptureLauncherModal.qmland the bar popoutCaptureMenu.qml. Move the deferred capture/record dispatch intoQuickCaptureDaemon.qmland pass the selected mode, action, output and widget to it before closing the popout.Why
runAfterPopoutClosed()closes the popout and then schedules the supplied callback withQt.callLater(). Closing the centered menu destroys its content, but the callback still accesses that menu'sroot(and, for recording, the delegate'smodelData). Selecting an action can therefore close the menu without starting capture or recording.Observed errors on Niri with DMS 2.0.0 and Quick Capture 5.9.0:
The new daemon methods close the originating widget and create the deferred callback in the persistent daemon's context. The callback no longer reads the destroyed menu or delegate. Capture modes, copy/edit actions, output selection and recording modes remain unchanged.
Reproduction
dms ipc call quickCapture toggle, or open the bar widget's popout.How tested
git diff --checkpassed.qmllint quickCapture/*.qml quickCapture/shared/*.qmlexited successfully. It reports warnings, including unresolved DMS imports in the standalone lint environment.qmllint quickCapture/components/bar/CaptureMenu.qml quickCapture/components/bar/CaptureLauncherModal.qmlexited successfully with import/type warnings.python3 scripts/refactor_dcommon.py --check --requires-dms ">=2.0.0"passed: 417 files and 21 manifests checked.quickCapture/tests/test_menu_dispatch.pyand documented its usage in the developer guide. It extracts the actual production dispatch methods for both menu surfaces, destroys the originating menu duringclosePopout(), and checks deferred calls and their arguments. It also checks recording delegate wiring and missing-daemon guards. All 66 results passed: 31 functional cases plus setup/cleanup for each menu (nine capture modes × three actions, three recording modes, and the missing-daemon guard).python3 quickCapture/tests/test_menu_dispatch.py(requires Qt'sqmltestrunnerand QtTest imports;--qmltestrunnercan specify its path).dms ipc call plugins reload quickCapture; opening the menu via IPC succeeded. Real screen capture/recording is not exercised by the headless harness.No changes to shared components, IPC commands, dependencies, user settings or compositor keybindings. The local-only QML cache workaround used during interactive troubleshooting is intentionally excluded.
Summary by Sourcery
Preserve Quick Capture screenshot and recording actions when their originating menus are closed before deferred execution.
Bug Fixes:
Enhancements:
Documentation:
Tests: