VM Management - Reduce VM boot time - Debian 12 only - [TemplateVM] Enter sudo cp /lib/systemd/system/systemd-binfmt.service /etc/systemd/system, then delete After=local-fs.target from /etc/systemd/system/systemd-binfmt.service @renehoj

#!/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
[/details]

[details="open_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
[/details]

 

Input Devices

[details="Hide 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

[/details]

 

Storage - Send files directly to external storage mounted in other qube - [AppVM] Run the code below (expandable), then copy/move your file(s) @SteveC

[details="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]
[/details]

 

Networking

[details="vm-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
[/details]

 

Video playback - Reduce VLC's CPU usage - [AppVM] In VLC's preferences, open 'Video' and change 'Output' to 'X11 video output (XCB)' @solene

 

Etc. - View dom0 update history - [dom0] Enter dnf history to view update events; enter dnf history info [EVENT ID] to view event details. Also works for Fedora in general @adw

 

 


 

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 1. Your tip should contain as few words as possible   2. If your tip can't be condensed into a few lines, it doesn't belong here   3. If your tip is niche with regard to Qubes users, it doesn't belong here*   4. Follow the established style convention   5. 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