Skip to content

Release the window when the file chooser's portal goes away - #51

Merged
omarchybot merged 2 commits into
masterfrom
portal-vanishes
Nov 12, 2026
Merged

omarchybot merged 2 commits into
masterfrom
portal-vanishes

Conversation

@omarchybot

@omarchybot omarchybot commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

While a desktop file chooser is open, FileDialog::choose runs a nested event loop and filters out every key, click and close on Hype's own windows, so nothing changes under an import. It ends the loop on the portal's Response signal or a failed method call. If xdg-desktop-portal exits after accepting the request (a crash, a restart, a session update), or is replaced by another process with --replace, neither arrives: the loop never returns and the editor stays frozen, ignoring even the window's close button.

The dialog now watches who owns the portal's name on the session bus for as long as it waits. When the owner leaves or changes, the call returns with "The desktop file chooser closed without answering.", which the editor already shows in its status line like any other chooser error. A first owner appearing, as when the call itself starts the portal, is ignored.

The fake-portal test gains both cases: the portal accepts the request, then drops its name, or another connection takes it over. Without the watcher each hangs. That test only runs with HYPE_PORTAL_TESTS=1 under dbus-run-session, as before, because it claims the portal's name on the bus.

No CI runs here yet: master has no workflow until #48 lands, and #48's needs omacom/omarchy-pkgs#2573. Merged onto #48 with that pull request's dependencies, the tests pass.

🤖 Generated by Opus 5.5 in Claude Code. Reviewed by Codex XHigh.

While the chooser is open, Hype swallows input to its own windows and waits for the portal's response. A portal that exited after accepting the request never sends one, which left the editor locked with no way to close it. Watching the portal's name ends the wait with an error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Codex <noreply@openai.com>
@greptile-apps

greptile-apps Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable new issues were found.

Summary

FileDialog::choose now returns an error when the desktop portal loses its owner or another process replaces it.

  • Hype’s file chooser returns when the portal owner disappears or changes.

Reviews (2) · Last reviewed commit: "Also release the window when the portal ..." · Reviewed by Greptile

xdg-desktop-portal --replace hands the name straight to the new process, which never unregisters it, and the new process knows nothing of the old request. Any change of owner after the first one now ends the wait.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Codex <noreply@openai.com>
@omarchybot
omarchybot merged commit 5828494 into master Nov 12, 2026
1 check passed
@omarchybot omarchybot mentioned this pull request Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant