How to make qubes more keyboard friendly?

Qubes in general is not a lot of keyboard friendly. there are no shortcuts, for

  1. killnig a qube
  2. restarting a qube
  3. opeining the assigning of a usb to specific vm

i basically find myself revisint the blue qubes icon a lot.
So i have set windows shortcuts for qvm- kill shutdown commands
what other ways are there tomake qubes more keyboard friendly

2 Likes

There is a script for i3 to create a terminal for the qube that has focus. Maybe there is a better way to do this, but at least this could easily be modified to kill, restart or assign blkdevices to qubes.

If you are on xfce, i would guess something like this would also exist.

XFCE has keyboard shortcuts that let you execute arbitrary commands or at least .desktop files (which let you execute arbitrary commands). Just research on that.

There’s also [1] for people who like to control stuff from a terminal (or execute prompt) in a keyboard-efficient way.

[1] GitHub - 3hhh/qubes-terminal-hotkeys: keyboard efficient VM management for Qubes OS

2 Likes

Thanks for the link!

As this requires an open dom0 window and seems pretty static (no information about opened window or window in focus as far as i read) i think the “most challenging” part is to find out what window is in focus. If you can get that, you can script anything you like and hook it to a shortcut.

I found a solution here

ID=`xdotool getwindowfocus`
QUBE=`xprop _QUBES_VMNAME -id $ID|cut -f2 -d\" `

does return the name of the qube that has the active window.

  1. Script whatever you want like opening terminals, attaching blkdevices or restarting.
  2. Create a keyboard shortcut, for example with the “keyboard” setting of xfce and launch your script

Have fun :slight_smile:

PS: @McbXPdkWfyGbyvJvpXpw Thank you very much for asking this question! Now i have many many ideas on what i can do with that like creating keyboard shortcuts to modify networking of active qubes however i like and such like.

1 Like

Just wrote a little “godark” script that disables networking for the active qube. Maybe this can be used as an inspiration on how and what one can do with this.

content of /home/baflya/godark

#!/bin/bash
# Go dark script
#
# Disables networking for the qube in focus and creates a notification
# to confirm

# Get active window
ID=`xdotool getwindowfocus`
TARGET=`xprop _QUBES_VMNAME -id $ID|cut -f2 -d\"`
if [[ "$TARGET" == "_QUBES_VMNAME: not found." ]]; then
  notify-send "Could not get active qube to go dark"
  exit 1
fi

# Disable networking
qvm-prefs --set "$TARGET" netvm none

# Check and notify user
NETVM=$(qvm-prefs --get "$TARGET" netvm)
if [[ "$NETVM" == "" ]]; then
  notify-send "Qube $TARGET went dark"
else
  notify-send -u critical "Qube $TARGET was UNABLE to go dark"
fi

it is executable (chmod +x godark)

And i set a keyboard shortcut in xfcemenu → System Tools → keyboard

for
ctrl+b with the command /home/baflya/godark

May contain bugs, just see this as a quick n dirty example. For me this is working fine tho.

3 Likes

Same as other users, I use the XFCE keyboard shortcuts, some example:

  • Right MS-Windows key launch a firefox from DispVM (Super R → qvm-run -q -a --service --dispvm=fedora-35-dvm -- qubes.StartApp+firefox)
  • Left MS-Windows key launch the Whisker menu, then I input the first letters of the wanted VM application (Super L → xfce4-popup-whiskermenu)
  • create scripts and map them to shortcuts (as @baflya ), me I hide/show the cursor
  • add .desktop entries in the VMs and launch them from dom0 with XFCE shortcuts (Ctrl-Alt+T → qvm-run -q -a --service -- VM1 qubes.StartApp+org.gnome.TerminalVTop and in VM1 a org.gnome.TerminalVTop desktop entry with [1]):

[1]

[user@VM1 ~]$ grep ^Exec .local/share/applications/org.gnome.TerminalVTop.desktop 
Exec=gnome-terminal --geometry=100x45+950+200

Note: Whisker is an XFCE alternative menu, search in this forum…

qmenu enables you to do all of this via keyboard.

Just be aware that the latest release(in the repository) is pretty outdated, but it will receive an update in the near future. Of course, you can install the most recent development version manually if you are capable to verify for yourself that it will not act maliciously.