Quick Quality-of-Life Improvements

Like this?

autostart_menu
#!/bin/bash

# vms to start
declare -a work_qubes=("work-vm1" "work-vm2" "work-vm3")
declare -a system_qubes=("sys-net" "sys-firewall" "sys-usb" "sys-vpn")
declare -a admin_qube=("admin-vm1" "admin-vm2")
declare -a comms_qube=("comms-vm1" "comms-vm2")

# commands to launch apps
declare -a browser_firefox=("browser firefox")

start_qubes() {
  qubes_to_start=("${!1}")

  for qube in "${qubes_to_start[@]}"; do
    echo "Starting $qube..."
    qvm-start "$qube" || echo "Failed to start $qube"
  done
}

run_application() {
  app_to_start=("${!1}")

  for qube in "${app_to_start[@]}"; do
    echo "Starting $apps..."
    qvm-run -p "$" || echo "Failed to start $app"
  done
}

prompt_user() {
  startup_choice=$(zenity --list --radiolist --height 200 --width 250 --title="Select Startup Group" --text "Choose a group of qubes to start:" --column "Pick" --column "Startup Group" TRUE "Work Qubes" FALSE "System Qubes" FALSE "Admin Qube" FALSE "Comms Qube" FALSE "Browser Firefox")

  case "$startup_choice" in
    "Work Qubes")
      echo "Starting work qubes..."
      start_qubes work_qubes[@]
      ;;
    "System Qubes")
      echo "Starting system qubes..."
      start_qubes system_qubes[@]
      ;;
    "Admin Qube")
      echo "Starting admin qubes..."
      start_qubes admin_qube[@]
      ;;
    "Comms Qube")
      echo "Starting comms_kick..."
      start_qubes comms_qube[@]
      ;;
    "Browser Firefoz")
      echo "Starting Firefox in Browser"
      run_application browser_firefox[@]
      ;;
    *)
      echo "No option selected. Exiting."
      ;;
  esac
}

echo "QubesOS autostart script initialized"
prompt_user

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.

That was my first impression, too @fiftyfourthparallel.

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.

Does not work for me.

in /etc/lightdm/lightdm.conf I set with sudo:

#autologin-user=

to

autologin-user=dom0-username

also tried user since I was not sure if you have used username as an alias for your actual Qubes OS user name (in my case user)

autologin-user=dom0-user

I also tried shutdown and power on again instead of reboot.

Qubes OS always asks for the user’s password on boot (after LUKS password).

PS: My system runs coreboot but I do not think that should impact this configuration.

Is your username dom0-user? For instance, if my username is solene then the line should be autologin-user=solene

3 Likes

Thanks, confirmed, it works.
Sorry, for my foolishness :see_no_evil:

3 Likes

Maybe @renehoj wants to modify the code line:

autologin-user=dom0-username

to

autologin-user=<your_dom0_username>

@whoami @renehoj Done

1 Like

Dom0 also offers screenshot per window. default ist Alt+Print, but this sometimes leads to revoking the right click action i wanted to screenshot.

1 Like

NETVM CHANGER.

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.

1 Like

Decrease Time to Login Prompt/Autologin

  • Modify qubes-vm@.service to be a simple systemd service
    • Create override config using command sudo systemctl edit qubes-vm@.service
    • Insert following lines in active section, ABOVE the line ### Lines below this comment will be discarded
      • [Service]
        Type=simple
        
    • Explanation: simple service allows systemd to boot next service without checking exit status or successful launch of command unlike oneshot
2 Likes

@den1ed Added as an alternative, thanks
@a_lurker_no_more Added, thanks

1 Like

I forget this one:

Show netvm from focused window

netvm_show
#!/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