Last active
March 29, 2023 10:55
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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