VM Management
-
Free up dom0 disk space - [dom0]
sudo journalctl --vacuum-time=1d
@renehoj -
Reduce VM boot time - Debian 12 only - [TemplateVM] Enter
sudo cp /lib/systemd/system/systemd-binfmt.service /etc/systemd/system
, then deleteAfter=local-fs.target
from/etc/systemd/system/systemd-binfmt.service
@renehoj -
Shut down selected window’s VM - [dom0] Create
/bin/halt-vm-by-window.sh
(expandable), make it executable (chmod +x
), then map to shortcut @taskethalt-vm-by-window.sh
#!/bin/bash CUR_WIN_ID=`xdotool getwindowfocus` CUR_VM=`xprop _QUBES_VMNAME -id $CUR_WIN_ID |cut -d \" -f2` qvm-run $CUR_VM 'xdotool search --name "Mozilla Firefox" key ctrl+q' qvm-run $CUR_VM 'xdotool search --name "Mozilla Thunderbird" key ctrl+q' sleep 4 /usr/bin/qvm-shutdown $CUR_VM --wait --timeout=40
-
Open selected window’s VM’s terminal [dom0] Create
/home/user/bin/open_terminal.sh
(expandable), make it executable (chmod +x
), then create key binding. To open as root, replaceqvm-run
withqvm-run -u root
@unmanopen_terminal.sh
#!/bin/bash ID=`xdotool getwindowfocus` QUBE=`xprop _QUBES_VMNAME -id $ID|cut -f2 -d\" ` if [[ "$QUBE" == "_QUBES_VMNAME: not found." ]]; then exit else qvm-run $QUBE /usr/bin/qubes-run-terminal & fi
-
Open selected window’s template VM’s terminal - [dom0] Create
/home/user/bin/open_template_terminal.sh
(expandable), make it executable (chmod +x
), then create key binding. To open as root, replaceqvm-run
withqvm-run -u root
@renehoj"open_template_terminal.sh
#!/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
-
Memory warning notifications - [dom0] Create the files below as needed, then for each file:
chmod +x [FILENAME]
, entercrontab -e
, then add*/5 * * * * [FILENAME]
and save @ddevz/bin/dom0-Memory-Notification
#!/bin/bash FREE_MEMORY=$((`free -m | grep '^Mem' | awk '{print $7}'`)) if (( $FREE_MEMORY < 500 )); then notify-send --expire-time=360000 --urgency=critical 'dom0: Low memory' "Remaining: $FREE_MEMORY MBs" fi
/bin/Xen-Memory-Notification
#!/bin/bash FREE_MEMORY=$((`xl info | grep free_memory | sed 's/^.*:\([0-9]*\)/\1/'` / 1000)) if (( $FREE_MEMORY < 8 )); then notify-send --expire-time=360000 --urgency=critical 'Xen: Low memory' "Remaining: $FREE_MEMORY GBs" fi
Input Devices
-
Prevent loss of control from sys-usb shutdown - [dom0]
crontab -e
, then enter* * * * * qvm-start --skip-if-running sys-usb > /dev/null 2>&1
and save. Reverse the change by commenting out that line @SteveC -
Create a toggle to hide the cursor - [dom0] Install
unclutter
, run the code below (expandable), then maptoggle-unclutter.sh
to a key @ludovic vecna13 from the 2676 issueHide cursor (dom0)
mkdir $HOME/bin cat << 'EOF' | tee $HOME/bin/toggle-unclutter.sh #! /bin/sh if pgrep unclutter &> /dev/null 2>&1 then killall unclutter else unclutter -idle 1 & fi EOF chmod +x $HOME/bin/toggle-unclutter.sh
Storage
-
Send files directly to external storage mounted in other qube - [AppVM] Run the code below (expandable), then copy/move your file(s) @SteveC
In destination qube:
In the following instructions
[ORIGIN QUBE]
is the qube name without brackets or slashes!mkdir ~/QubesIncoming mv ~/QubesIncoming/[ORIGIN QUBE] ~/QubesIncoming/[ORIGIN QUBE]_backup ln -s [MOUNT POINT] ~/QubesIncoming/[ORIGIN QUBE]
Networking
-
Toggle NetVM of qube in focus - [dom0] In dom0 create the following script, make it executable (
chmod +x
), and bind to keyboard shortcut (expandable) @Bearillovm-give-default-network
#!/bin/bash CUR_WIN_ID=$(xdotool getwindowfocus) CUR_VM=$(xprop _QUBES_VMNAME -id $CUR_WIN_ID | cut -d \" -f 2) if [[ "$CUR_VM" != *"not found"* ]];then if ! qvm-prefs "$CUR_VM" netvm | head -c1 | grep -E '.';then TEXT="TOR" while read -r line do if [[ "$line" == "anon-vm" ]];then TEXT="TOR" break else TEXT="DEFAULT" fi done <<< $(qvm-tags "$CUR_VM") ANSWER=$(notify-send -A Y="Yes" -A N="No" "Grant $TEXT network access to $CUR_VM" "Do you want to grant $TEXT network access to $CUR_VM?") if [[ "$ANSWER" == "Y" ]];then if [[ "$TEXT" == "DEFAULT" ]];then qvm-start --skip-if-running $(qubes-prefs default_netvm) && qvm-prefs "$CUR_VM" netvm -D && notify-send "Granted $CUR_VM $TEXT network access!" "The netvm of $CUR_VM was set to $(qvm-prefs "$CUR_VM" netvm)." else qvm-start --skip-if-running sys-whonix && qvm-prefs "$CUR_VM" netvm sys-whonix && notify-send "Granted $CUR_VM $TEXT network access!" "The netvm of $CUR_VM was set to $(qvm-prefs "$CUR_VM" netvm)." fi fi else qvm-prefs "$CUR_VM" netvm None notify-send "Disconnected $CUR_VM from network!" "The netvm of $CUR_VM was set to None (n/a)." fi fi
-
Keep WiFi off by default on boot - [TemplateVM] In sys-net’s template, create
/var/lib/NetworkManager/NetworkManager.state
containing the code below (expandable) @BearilloNetworkManager.state
[main] WirelessEnabled=false
-
Soft toggle WiFi - [dom0]
qvm-run sys-net -- "if nmcli radio wifi | head -c1 | egrep 'e'; then nmcli radio wifi off; else nmcli radio wifi on; fi"
(can be mapped to shortcut) @Bearillo
Video playback
-
Reduce VLC’s CPU usage - [AppVM] In VLC’s preferences, open ‘Video’ and change ‘Output’ to ‘X11 video output (XCB)’ @solene
-
Reduce mpv’s CPU usage (link includes guide for YouTube too) - [TemplateVM] In
/etc/mpv/mpv.conf
, insertvo=x11
andprofile=sw-fast
as separate lines @Bearillo
Bug workarounds
- Prevent resizing windows from crashing xorg in qube - [dom0] Window Manager > Advanced > Hide content of windows: When resizing @renehoj
Etc.
-
View dom0 update history - [dom0] Enter
dnf history
to view update events; enterdnf history info [EVENT ID]
to view event details. Also works for Fedora in general @adw -
Automatically log into dom0 on boot [dom0] In
/etc/lightdm/lightdm.conf
, uncomment and setautologin-user=[your dom0 username]
@renehoj -
Disable notifications per VM - Fedora-XFCE only - [AppVM] Run
xfce4-notifyd-config
, thenxfconf-query -c xfce4-notifyd -p /do-not-disturb --set true
@solene -
Trigger the QubesOS widgets via keyboard - [dom0] In dom0 create a script containing the code below (expandable), make it executable (
chmod +x
) and bind to keyboard shortcut @Bearillowidget-click.sh
Call this script with either the argument
devices
(sowidget-click.sh devices
) ordomains
to open the respective widget.#!/bin/bash # call with argument 'devices' or 'domains' sleep 0.1 eval $(xdotool search --onlyvisible --name "qui-$1" getwindowgeometry --shell) xdotool mousemove $X $Y click 1 mousemove restore
-
Trigger the QubesOS app menu via keyboard - [dom0] In dom0 create a script containing the code below (expandable), make it executable (
chmod +x
) and bind to keyboard shortcut @Bearilloqubes-menu.sh
Note that you may need to adjust the numbers if your screen is not 1080p.
#!/bin/bash eval $(xdotool getmouselocation --shell) xdotool mousemove 5 5 gdbus call --session --dest org.qubesos.appmenu --object-path "/org/qubesos/appmenu" --method org.freedesktop.Application.Activate "{}" if [ $X -lt 720 ] && [ $Y -lt 775 ]; then X=720 # prevent the mouse from selecting items in the app menu when opening it with the keyboard fi # note that these values may need adjusting if using a screen with a resolution other than 1080p xdotool mousemove $X $Y
-
Create a custom mode for launching apps quickly- i3 only - [dom0] Open
~/.config/i3/config
, then add the contents ofconfig.append
(expandable) . Alter shortcuts and qube names as needed. @q4uconfig.append
# Replace example appVM and names/commands with your own set $mode_launcher Launch: [e]macs [m]ail [s]ignal bindsym $mod+o mode "$mode_launcher" mode "$mode_launcher" { bindsym e exec qvm-run app-dev "emacsclient -c -a 'emacs'" bindsym s exec qvm-run app-signal signal-desktop bindsym m exec qvm-run app-mail thunderbird bindsym Escape mode "default" bindsym Return mode "default" }
-
Open selected window’s VM’s terminal - i3 only - [dom0] Open
~/.config/i3/config
, then addbindsym $mod+Return exec qubes-i3-sensible-terminal
. To open as root, replacequbes-i3-sensible-terminal
withqubes-i3-sensible-terminal.root
. Alter shortcut as needed. @ruza -
Screenshot a window - [dom0] Create
/bin/screenshot_VM.sh
(expandable), make it executable (chmod +x
), then map to shortcut. @steffen and other contributors on Githubscreenshot_VM.sh
#!/bin/sh # lets the user take a screenshot based on rectangular selection and sends it to the currently focused VM CUR_WIN_ID=`xdotool getwindowfocus` CUR_VM=`xprop _QUBES_VMNAME -id $CUR_WIN_ID | cut -d \" -f 2` if [[ "$CUR_VM" != "_QUBES_VMNAME: not found." ]]; then xfce4-screenshooter -r -o "qvm-copy-to-vm $CUR_VM" notify-send "Screenshot sent!" "Your selection has been sent as a screenshot to $CUR_VM!" fi
This is a thread where we collect quick tips and tricks that can improve the Qubes experience.
Feel free to add your tip to this wiki post (anyone can edit this)
Guidelines
- Your tip should contain as few words as possible
- If your tip can’t be condensed into a few lines, it doesn’t belong here
- If your tip is niche with regard to Qubes users, it doesn’t belong here*
- Follow the established style convention
- Give credit, even to yourself, and link to the original (if needed, also post your tip as reply so you have a link)
* “What’s niche?” is going to spawn a lot of debate and angst, but this constraint is necessary to prevent the post from getting bloated and mostly irrelevant