Open terminal for the template of the active windows.
#!/bin/bash
CUR_WIN_ID=`xdotool getwindowfocus`
CUR_VM=`xprop _QUBES_VMNAME -id $CUR_WIN_ID |cut -d \" -f2`
CUR_VM_TEMP=`qvm-prefs $CUR_VM template`
qvm-run -q -a --service -- $CUR_VM_TEMP qubes.StartApp+qubes-run-terminal
exit 0