If I’m not mistaken, what your script does is launch a predefined (hardcoded) set of VMs and apps only upon Qubes OS startup.
What @q4u’s code does is allow users to enter a shortcut whenever they want (e.g. $mod + o), then enter commands (e.g. “fm” to open Firefox and Mail), then press ESC to exit and execute.
I’m unsure what zenity does, but on second read it makes the impression to me that @kenosen’s stuff does in fact prompt the user for input/choice on what to start.
Although I think this might be tied with XFCE.
It might not be a one-fits-all solution but a XFCE-only functionally-equivalent variant of what my script/i3-config does.
Ah, then I defer back to those hotkeys from 3hhh and hotkey a dom0 terminal open/close, though using a verve command line in the xfce panel is another option.
I have made some modifications in one script that was posted here, it list the vms that have provides_network true and popup a menu list using zinity to choose the new netvm on the focused window.
#!/bin/bash
# Get the ID of the focused window
ID=$(xdotool getwindowfocus)
QUBE=$(xprop _QUBES_VMNAME -id $ID | cut -f2 -d\")
# Variable to store the NetVM
netvm=""
# Check if the current VM has a defined NetVM
if [ -n "$QUBE" ]; then
netvm=$(qvm-prefs "$QUBE" netvm)
fi
# Check if a NetVM was found
if [ -z "$netvm" ]; then
notify-send "No NetVM found for $QUBE."
exit 0
else
notify-send "The NetVM for $QUBE is: $netvm"
fi
@renehoj When double-checking I realized I misread your post.
Since your script needs an input it can’t be made into a shortcut, as-is. However I feel your script can use a UX improvement, where users can just apply it to the current window when needed without worrying about anything else, but power users also have the option of invoking the CLI version with input parameters.
What I have in mind is a toggle system, where the script resets the priority of all other VMs and raises the priority of the selected window’s VM to a predefined level (e.g. 512) and, if possible, adds some sort of indicator to the window title or title bar (like a star). To reset all priorities just use the shortcut on a boosted VM’s window.
What do you think?
Example:
I select an app-browsing window and then enter “ctrl + shift + B”, invoking reneboost.sh. This causes app-browsing to increase to 512. A star appears in front of its dom0 titlebar name.
I select and app-media window and enter the shortcut. This causes all other VMs, including app-browsing, to return to 256 while app-media is boosted to 512. A star appears in front of app-media’s dom0 titlebar name while vanishing from app-browsing’s.
To reset all priorities to 256, I select an app-media window and enter the shortcut again. The star vanishes.
For finer-grained adjustments, I use your script as you originally intended.
All this may be a bit beyond the scope of this thread, but I reckon it’s worth it.
The input is a command line parameter, it works with XFCE shortcuts.
You can toggle it on and off by making two shortcuts to the same script, 512 to increase priority and 256 to reset, the domian will also reset when it shuts down.
I don’t think you can easily permanently change the title, at least I don’t know how. You can change the title with xdotool, if the qube changes the title your change will be overwritten.
The problem is that users have to manually keep track of Xen priorities for each VM. I don’t know of an easy way to look up Xen priorities (a column in Qubes Manager in the future?), and even if I did it’d be something of a pain to do so frequently.
Adding to the confusion is the fact that it’s not clear if these priorities reset upon VM shutdown or Qubes OS shutdown. So it’s entirely possible someone ends up setting a 1024 and forgetting, then whenever that VM is on it ends up hogging most resources.
This is why I’m hesitant to add your entry as-is, since the lack of guardrails means there’s potential for serious and somewhat permanent (if completely forgotten) performance degradation.
I recommend a dom0 window shortcut that only allows one VM at a time to be boosted, and shows an indicator. This UX also makes it easier to boost-when-needed and without much effort. The function you wrote can be for power users who want to set-and-forget for some VMs, have different priority tiers, etc.
You’ve contributed a ton to this thread and the community in general so I’m not really asking you, specifically, for more work; if anyone reading this can upgrade this entry I’d be grateful and you’d also get co-credit.