Go back to topic: NetVM Changer bash script
1. Need to install zenity in dom0
2. Need to install notification-daemon and dbus-x11 on fedora template
3. Script will popup menulist to select NetVM based on (qvm-ls and qvm-prefs).
| **1.** Need to install zenity in dom0 **2.** Need to install notification-daemon and dbus-x11 on fedora template **3.** Script will popup menulist to select NetVM based on (qvm-ls and qvm-prefs).  **4.** All notifications use notify-send, fedora templates need a fix in in: |
Edit the file | Edit the file inside template and add the lines: |
``` to run the script create a folder in dom0 /home/your-login/bin/netvm-changer.sh give chmod +x netvm-changer.sh add a keyboard shortcut to run the script on desired focus vm ``` #!/bin/bash vms_with_network=() ID=`xdotool getwindowfocus` QUBE=`xprop _QUBES_VMNAME -id $ID|cut -f2 -d\" ` # get netvm list all_vms=$(qvm-ls --raw-list) && notify-send "Searching VMs to provide network..." # VMs netvm true for vm in $all_vms; do # Check provides_network=$(qvm-prefs "$vm" provides_network) # If true then add it if [ "$provides_network" == "True" ]; then vms_with_network+=("$vm") fi done notify-send "Done!" # Verification if [ ${#vms_with_network[@]} -eq 0 ]; then notify-send "No VMs available to provide network.. Aborting!" exit 0 fi # VMs available to provide network selected_vm=$(printf "%s\n" "${vms_with_network[@]}" | zenity --list --title=">>> NetVM Changer <<<" --column="NetVM available for $QUBE:" --height=400 --width=400 --print-column=1) # Check if selected if [ -n "$selected_vm" ]; then notify-send "Modifying $QUBE networking..." --title="NetVM Changer" if [[ "$QUBE" == "_QUBES_VMNAME: not found." ]]; then exit else qvm-start --skip-if-running $selected_vm && qvm-prefs $QUBE netvm "$selected_vm" && notify-send "Successfuly changed $QUBE networking to: $selected_vm" fi else notify-send "Aborting NetVM changes for $QUBE!" fi |