Skip to content

Instantly share code, notes, and snippets.

@caputomarcos
Last active March 29, 2023 10:55
Show Gist options
  • Save caputomarcos/3ed5b99865628f80ba6287a517a79d3f to your computer and use it in GitHub Desktop.
Save caputomarcos/3ed5b99865628f80ba6287a517a79d3f to your computer and use it in GitHub Desktop.
qubes-i3-wow: A Quick and Efficient Way to Share Information Between Qubes VMs
#!/usr/bin/bash
get_id() {
local id=$(xprop -root _NET_ACTIVE_WINDOW)
echo ${id##* } # extract id
}
get_vm() {
local id=$(get_id)
local vm=$(xprop -id $id | grep '_QUBES_VMNAME(STRING)')
local vm=${vm#*\"} # extract vmname
echo ${vm%\"*} # extract vmname
}
main() {
local vm=$(get_vm)
if [[ -n "$vm" ]]; then
if command -v qrexec-client >/dev/null; then
qrexec-client -e -d "$vm" DEFAULT:"bash -c 'xclip -selection clipboard -out | xdotool selectwindow windowfocus type --clearmodifiers --delay 25 --window %@ --file -'"
else
qvm-run "$vm" qvm-run "$vm" "bash -c 'xclip -selection clipboard -out | xdotool selectwindow windowfocus type --clearmodifiers --delay 25 --window %@ --file -'"
fi
fi
}
main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment