After searching for this for like ever, I wanted to ask here, if someone has a permanent, relatively simple solution to the Clipboard Problem with Screenshots.
On Qubes R4.2.4 I cannot get the Screenshot Application to work at all. Only thing that works is Saving the screenshot in dom0, which I don’t really like. There IS a option to copy it to the clipboard, but I’ve never seen it actually work. Is there some workaround for this? It would surely be more convenient to just copy the image to the system wide clipboard and then paste it in a particular qube, then always having to move the image file from dom0 to a qube and so on.
save it in dom0 (by default in the ~/Pictures directory)
in dom0, to move the file, say “test.png”, to the qube “personal”, for example, I run: cat Pictures/test.png | qvm-run --pass-io personal -- 'cat > Pictures/test.png'
edit/process the file in the “personal” qube…
As I don’t do this very often, I did not wrap it up in a script… but it’s trivial to do so (together with some sanity checks).
There’s a contrib package - look at the README here
: you could leverage that to ape a global clipboard, since I believe it
has the possibility to copy to clipboard in a qube.
In general I dont like copying anything from dom0 to the global
clipboard, and much prefer having to specify the target. That’s me.
I never presume to speak for the Qubes team.
When I comment in the Forum I speak for myself.
Execute the commands to create the directory structure and place the previously mentioned script in $HOME/.local/bin/custom-screenshooter
# Run on dom0 as USER
mkdir -p $HOME/.local/bin
cat <<EOF > $HOME/.local/bin/custom-screenshooter
#!/bin/bash
screenshot_file="$HOME/Pictures/Screenshot_$(date +%F_%H-%M-%S).png"
xfce4-screenshooter -r -s "$screenshot_file"
if [[ -f "$screenshot_file" ]]
then
vms=$(qvm-ls --running --raw-list --fields NAME |grep -vE '^(dom0$)|(debian|default|fedora|sys)-|vault$')
target_vm=$( echo "$vms" | zenity --list --title="Copy to vm" --column="VM" --height=400 --width=300)
if [[ -z "$target_vm" ]]
then
exit 1
fi
qvm-copy-to-vm "$target_vm" "$screenshot_file"
fi
EOF
chmod 700 $HOME/.local/bin/custom-screenshooter
As we know, you can’t copy to dom0 from the clipboard.So how do you copy this script? Copy it to a file in any AppVM and on dom0 copy the contents of the file to dom0:
Set the keyboard shortcut. Qubes Application Menu → Settings Icon → Keyboard → Application Shortcuts → Add. In the ‘command’ field type /home/youruser/.local/bin/custom-screenshooter and select the key (e.g. PrintScreen).
Notes:
I use xfce4-screenshooter, although another one (e.g. built into kde Spectacle) is better. By better I mean that it allows more functionality, e.g. the ability to edit the screen, such as selecting something on it, simple cropping, etc. The tool is cool, but when I saw how many dependencies it requires - I gave up.
I think that such a solution (of course in a more advanced form) could be a nice feature for default qubes OS installations as, for example, a screenshooter configuration option, although it would probably be necessary to carefully consider how to implement it in a safe way.