How do I save a screenshot to save on a Qube?

I don’t remember where I found this (probably somewhere on this forum), but credit to whoever originally shared it. I’ve been using it and it’s surprisingly handy, even if it’s not perfect.

On dom0 ~/bin/screenshot_VM.sh:

#!/bin/sh
# lets the user take a screenshot based on rectangular selection and sends it to the currently focused VM

CUR_WIN_ID=`xdotool getwindowfocus`
CUR_VM=`xprop _QUBES_VMNAME -id $CUR_WIN_ID | cut -d \" -f 2`

if [[ "$CUR_VM" != "_QUBES_VMNAME:  not found." ]]; then
	xfce4-screenshooter -r -o "qvm-copy-to-vm $CUR_VM"
	notify-send "Screenshot sent!" "Your selection has been sent as a screenshot to $CUR_VM!"
fi

Then just bind it to the Print Screen key in xfce4-keyboard-settings, or whichever key you prefer.

2 Likes