How do I take in-qube screenshots?

Continuing the discussion from How to move screenshot from dom0 to appVM?:

Can this be made split subtopic?
How to make screenshot in Qubes Qube vm?
I would like to install seperate screenshot tool, so i could have screenshots in vm of vm im using, not made in dom0 and then looking how to move them in place from where i wanted to make screenshot from. Tried installing gnome-screenshot, but it gives error
** Message: 01:08:20.680: Unable to use GNOME Shell’s builtin screenshot interface, resorting to fallback X11.

Fedora, Debian, etc come with a screenshot tool that will save to the local VM’s picture directory. Of course, opening the file manager, you can move files around within the VM and also use the context menu to copy/move to another AppVM.
I see “Screenshot” software available in Qubes Settings > Applications > Available list

I dont have in debian template. In Fedora template Qubes i see Screenshot, but im not familliar with Fedora cli, so using Debian. Qubes 4.1 RC3.
So for Fedora users that is then fixed, but for Debian users what is missing or can manually to install? I have that error.

The standard method is to hit PrintScreen, but that is taken over by dom0. I have used in the past ksnip, flameshot, or kazam. Installs for that could be done via apt/snap.

It would be nice if there was a pass-through keystroke for PrintScreen (similar to global clipboard) that would screenshot inside the focused AppVM.

Here’s a generic script for dom0 that will identify the focused qube.

#!/bin/bash
ID=`xdotool getwindowfocus`
QUBE=`xprop _QUBES_VMNAME -id $ID|cut -f2 -d\" `
if [[ "$QUBE" == "_QUBES_VMNAME:  not found." ]]; then
  exit
else
# Do something with $QUBE
fi

In Debian, install the x11-apps package.
Then you can run :
xwd| xwdtopnnm| pnmtopng > screenshot.png
This will make the pointer in to a cross hair so you can select the window
you want.

So combine these two, link the script to a keyboard shortcut, and that
will do exactly what you want.
You’ll need to make the file name for the screenshot variable, of
course.

I never presume to speak for the Qubes team.
When I comment in the Forum or in the mailing lists I speak for myself.
2 Likes

Wonderful, thank you @unman !

Do you know, if there is a similar any way to dump an X11 window as video for recording capability (not only as screenshot)?

All solutions I read about required a binary to be installed in dom0.

Just to be clear - you want to take streaming from a qube window and use
it in that qube, without installing in to dom0?
If so, I’ll have to think on that.

Yes, exactly.

A use case is to spin up a test qube, in which I stream/record an app window for videos tutorials or debugging help.

Personally, I shy away from installing binaries in dom0. Delegating this video stream to a test qube (x11-apps or even more sophisticated tool like OBS) would be ideal middle-ground.

Naively I would think, a video stream is a sequence of screenshots. But I don’t know much about x11-apps and reality probably is a bit more complex :wink:

Hi, Was wanting something like this that is easy and efficient to use. Have created this just now: GitHub - scott-m-willett/qvm-screenshot: A small yet effective way to take region screenshots in Qubes (in dom0), and auto upload them to a VM.