Wipe VM Clipboards With a Trigger?


At the moment when we use Ctrl+Shift+v the notification we receive is:

Qubes Clipboard
Qubes Clipboard has been copied to the VM and wiped…”

Which I believe means that Dom0 clipboard is wiped. Not the original outgoing VM, nor the receiving VM.

What I would like to learn how to configure is when certain steps of the Copy & Paste sequence between VMs are completed, for that to trigger a countdown timer that will automatically wipe the outgoing and incoming VM clipboard.

Time Trigger Example:

  1. (vm1) Ctrl+c: Bytes copied to vm1 clipboard, and 30 second wipe timer begins for vm1 clipboard;
    if Ctrl+c is used again in vm1 before 30 seconds has elapsed, it will wipe the previously copied bytes and replace with new.

  2. (vm1) Ctrl+Shift+c: Bytes transferred from vm1 clipboard to Qubes Clipboard.

  3. (vm2) Ctrl+Shift+v: Bytes transferred from Qubes Clipboard to vm2 clipboard, and immediately wipe Qubes Clipboard (already happens).

  4. (vm2) Ctrl+v: Bytes pasted from vm2 clipboard, and 30 second wipe timer begins for vm2 clipboard;
    if Ctrl+Shift+v is used again to transfer bytes from Qubes Clipboard to vm2 clipboard before 30 seconds has elapsed, it will wipe the previously copied bytes in vm2 clipboard and replace with new.

1 Like

Not the solution you asked for, but I’ve resorted to using yet another key combination to clear the clipboard within a VM. If you install xsel in your templates, xsel -b -c can be used to clear the clipboard. xclip is an alternative.

From dom0, I get the active window, figure out the qube since the window will have a _QUBES_VMNAME X property, and execute:

qvm-run --no-gui VM "xsel -b -c"

Put those sequence of commands in a script, assign the script a window manager keyboard shortcut and clearing the VM clipboard is one keypress (like ctrl+shift+x).

So copy/pasting from KeePassXC to a target VM is:

  1. [vault] ctrl+c
  2. [vault] ctrl+shift+c
  3. [target] ctrl+shift+v
  4. [target] ctrl+v
  5. [target] ctrl+shift+x

If the source VM doesn’t clear the clipboard after a timeout, I could just refocus source VM window and ctrl+shift+x in there.

Example: Feature Request: Single-click NetVM Disable/Enable · Issue #4834 · QubesOS/qubes-issues · GitHub


That comment from Mar 7 by donob4n would be great:

Why don’t just clear with a delay after copying? Generally, users copy something with the immediate intention of paste it somewhere. Copy is like a requirement for the act of paste. If they don’t do it in a reasonable interval of time it is very likely that they abandoned their objective and after some minutes they probably even forgot that they had something copied.

This would also void mistakes with inter-qube copy/pastes. If the user forgets the special combination, he will have more chances of paste nothing than something wrong.

Seems a bit of a pain & mildly concerning that the best answer is another program needs to be installed across multiple templates to accomplish this.

For now it seems this is a good option for accomplishing what I need, due to the limitation of what we have available to us in the toolbox. Thank you Ice.

However, before I go that route does anyone know the specifics of how the clipboard manages bytes; if I simply select something random to copy in ”vm2”, will that erase the previous content from vm2’s clipboard to a state that’s not retrievable? Or is there some persistence in clipboard history?


  1. Paste password on login page
  2. Copy the word ”Username” above it’s related text box field.

Result: wiped secret, replaced with nothing important

1 Like

Yes this accomplishes the same thing; overwrite the clipboard with something benign, or clear it.

1 Like

One additional note - I wouldn’t say this is the “best” answer…it was the most convenient for me. It also isn’t necessarily an ideal solution, as dom0 is simply executing arbitrary code inside the VM which might be frowned upon if we look at dom0 as the abstract “AdminVM”.

There may also be information leaks (for example, traces of the action performed in ~/.xsession-errors if all output is not captured).