Hi all, Qubes noob here. I use a script on a keyboard bind to open a terminal in whatever VM is currently “in focus”. I essentially followed the instructions from “zoldkorte” comment in this reddit. This worked quite well on Qubes 4.0, but now that I finally had the time to migrate to 4.1 it no longer works. Unfortunately, I am not yet knowledgeable enough in Qubes to know where the script got broken. Do any of the veterans have any idea on how to fix it?
#!/bin/bash
run_terminal='
for t in $TERMINAL gnome-terminal xfce4-terminal urxvt rxvt terminator Eterm aterm xterm roxterm; do
which $t > /dev/null 2>&1 && exec $t;
done
'
get_id() {
# local id=$(xprop -root _NET_ACTIVE_WINDOW)
# echo ${id##* } # extract id
xprop -root _NET_ACTIVE_WINDOW | cut -d " " -f5 | cut -d"," -f1
}
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
qvm-run "$vm" "bash -c '$run_terminal'"
else # run terminal in dom0
exec bash -c "$run_terminal"
fi
}
main