On Debian 13 (Trixie) GNOME runs Wayland by default, which changes the answer a lot compared to older X11 advice.
GUI (built-in, easiest)
Press PrtScn: GNOME's screenshot UI opens at the bottom. Select the window mode (third icon), then click the window you want. Alt+PrtScn captures the currently focused window directly. Shots land in ~/Pictures/Screenshots.
Command line (no interaction)
GNOME Shell exposes a D-Bus API that works on Wayland:
This captures the focused window (true = include frame). So to shoot a specific "other" window: focus it first (click it or Alt+Tab), then run the command from a terminal that keeps focus after the switch, e.g. bind the command to a shortcut. Note that the standalone gnome-screenshot package is deprecated on modern GNOME.
X11 session only
If you're on an X11 session, you can target a window precisely by ID:
(import -window root for the whole screen, or use xdotool getactivewindow for the focused one.)
What doesn't work on GNOME Wayland
grim + slurp: requires wlroots-specific protocols, not supported by GNOME's compositor (Mutter).
xdotool, wmctrl, import -window <id>: X11 only.
flameshot: works partially under GNOME Wayland but its window-picking is unreliable.
There is no public Wayland/Mutter API to screenshot an arbitrary window by ID programmatically; the portal-based screenshot API always shows a dialog. The D-Bus method above plus focusing the window is the practical scripted approach.
Nov 16, 6:53pm
This is a shared conversation and may include unverified content that doesn't reflect Mistral AI's views. Login to resume chatting.
This is a shared conversation and may include unverified content that doesn't reflect Mistral AI's views. Login to resume chatting.