Skip to content

Hide the Annotator window during portal screenshots.#122

Merged
phase1geo merged 1 commit into
phase1geo:masterfrom
achilleleduc:fix-screenshot-hide-window
Apr 20, 2026
Merged

Hide the Annotator window during portal screenshots.#122
phase1geo merged 1 commit into
phase1geo:masterfrom
achilleleduc:fix-screenshot-hide-window

Conversation

@achilleleduc
Copy link
Copy Markdown
Contributor

Summary

The toolbar's Take Screenshot button always uses the XDG portal path, which previously did not hide the Annotator window before invoking the portal's interactive selector. As a result the window appeared in the captured area on single-monitor setups, forcing users to shrink or move it manually before each screenshot.

The non-portal path already honors the screenshot-include-win GSetting via hide() / show(). This PR mirrors that behavior in do_screenshot_portal: when the setting is false (the default), hide the window before issuing the portal call and re-show it from the existing response handler (or from the catch block if the D-Bus call itself fails).

On Wayland, hide() returns before the compositor has actually unmapped the window, so a 200 ms async wait is inserted between hide() and the portal call. Without it the window is still visible (and capturable) when the portal selector appears. The wait is gated on the same !include condition so it doesn't affect users who explicitly opt to include the window.

Test plan

  • Click Take Screenshot on Wayland — Annotator window disappears before the portal selector opens.
  • Selected region does not contain the Annotator window.
  • After confirming the selection, the window reappears with the screenshot loaded.
  • Cancelling the portal (Esc) re-shows the window via the existing failure-branch show() in handle_screenshot_callback.
  • Setting screenshot-include-win to true via gsettings keeps the window visible (no regression vs. previous behavior).

The toolbar's Take Screenshot button always uses the XDG portal path,
which previously did not hide the Annotator window before invoking the
portal's interactive selector.  As a result the window appeared in the
captured area on single-monitor setups, forcing users to shrink or move
it manually before each screenshot.

The non-portal path already honors the screenshot-include-win GSetting
via hide() / show().  Mirror that behavior in do_screenshot_portal: when
the setting is false (the default), hide the window before issuing the
portal call and re-show it from the existing response handler (or from
the catch block if the D-Bus call itself fails).

On Wayland, hide() returns before the compositor has actually unmapped
the window, so a 200 ms async wait is inserted between hide() and the
portal call.  Without it the window was still visible (and capturable)
when the portal selector appeared.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@phase1geo phase1geo merged commit 9b8c0b0 into phase1geo:master Apr 20, 2026
1 check passed
@phase1geo
Copy link
Copy Markdown
Owner

Thank you again. The change looks good.

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.

2 participants