Enable selection and window capture on Wayland via interactive XDG portal#817
Open
luigimassa wants to merge 2 commits into
Open
Enable selection and window capture on Wayland via interactive XDG portal#817luigimassa wants to merge 2 commits into
luigimassa wants to merge 2 commits into
Conversation
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…G portal On Wayland, Shutter could only capture the full screen through the XDG desktop portal; the Selection, Window and Active Window buttons were disabled because they rely on X11 (Wnck/GdkX11), which cannot enumerate or grab other windows under Wayland's security model (issue shutter-project#187). This routes those modes to the portal's interactive mode instead, where the compositor (e.g. GNOME) shows its own native picker (area/window/ screen) and returns an already-cropped image into Shutter's existing post-capture flow. Changes: - Wayland.pm: xdg_portal() takes an $interactive flag and adds the `interactive` boolean option to the Screenshot portal request (typed via Net::DBus::dbus_boolean). The full-screen request is unchanged. A portal Response of 1 (user cancelled) now maps to error code 5 (aborted by user) instead of 9, so cancelling the picker shows no error dialog. - bin/shutter: the Wayland guard now lets full/select/window/awindow through; the capture dispatch routes select/window/awindow to xdg_portal($s, 1) on Wayland; the Selection and Window buttons/menu items (toolbar and tray) are enabled on Wayland. Menu and tooltip capture stay disabled (not supported by the portal); the workspace/ window dropdown menus still require X11 to enumerate. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On Wayland, Shutter could only capture the full screen through the XDG desktop portal. The Selection, Window and Active Window modes were disabled because they rely on X11 (
Wnck/GdkX11), which cannot enumerate or grab other windows under Wayland's security model (#187).This PR routes those modes to the portal's interactive mode instead: the compositor (e.g. GNOME) shows its own native picker (area / window / screen) and returns an already-cropped image into Shutter's existing post-capture flow.
Changes
Wayland.pm:xdg_portal()takes an$interactiveflag and adds theinteractiveboolean option to theScreenshotportal request (typed viaNet::DBus::dbus_boolean). The full-screen request is byte-for-byte unchanged. A portalResponseof1(user cancelled) now maps to error code5(aborted by user) instead of9, so cancelling the picker shows no error dialog.bin/shutter:full/select/window/awindowthrough;select/window/awindowtoxdg_portal($s, 1)on Wayland;Out of scope (Wayland limitations)
--window=PATTERN) and fixed-geometry selection (-s=X,Y,W,H): the portal accepts neither a target nor coordinates.Testing
perl -cpasses on both modified files.Refs #187