Qubes OS: Startup Tips and Tricks

Qubes is great! I'm assuming you're using it because you take your privacy and security seriously. I'll also assume that you shut down your machine whenever you are not physically attached to it. With that being said, getting your system in to a usable state can be a deterrent to shutting down. Let's see if we can fix that...

Auto-start Qubes

You can set different qubes to autostart upon logging in. This will save you a few clicks each time you log in and potentially waiting on qubes to start up later.

From the Qubes Manager, enter the settings for the qubes want to auto-start and set them up to

Auto-start applications

You can set up each qube to automatically start applications every time the qube starts. There a few different ways to go about this:

Auto-start applications installed systemwide

These would anything you installed with the distro's package manager or that came packaged up with the template. Things like Firefox fall in to this category.

  • Open up a terminal
  • create an autostart directory: mkdir ~/.config/autostart
  • navigate to that new directory: cd ~/.config/autostart
  • Symlink whatever application you want to autostart. These applications will be found in /usr/share/applications
  • With the example of Firefox, you would ln -s /usr/share/firefox-esr.desktop firefox.desktop This places a symobolic link in ~/.config/autostart that points back to the actual .desktop file that can start Firefox. Each time this qube starts, Firefox will open up

Auto-start applications not installed systemwide

Sometimes you have an app vm where you've downloaded a .appimage on to. We'll assume that Obsidian.AppImage lives in your home directory. Here you can just create the .desktop file and place it directly in to the autostart directory.

  • mkdir ~/.config/autostart && cd ~/.config/autostart
  • Create the desktop file: nano obsidian.desktop
  • Inside the text editor you will add in the following information
[Desktop Entry]
Name=obsidian
Comment=obsidian
Exec=/home/user/Obsidian.AppImage
Icon=obsidian
Type=Application
Categories=Notes;
  • save the file and you're all set. Each time the qube starts it will run the Obsidian.AppImage that lives in your home directory

Arrange windows from auto-started applications

Cool. So now we can auto-start qubes and automatically open applications from those qubes. Now we're going to programitcally move those windows around to various desktops to organize our workspace.

Using wmctrl we can place a script in dom0 that will move windows around for us and change settings like "visible on all work spaces".

  • After all the windows are open you would normally have open, run wmctrl -x -l This will give you information about the open windows.
  • Think of the third column as the name assigned to each window. We can then use wmctrl to move these windows around and change other things about them. -r refers to the  window name, -t designates which desktop to move the window to
wmctrl -x -r anon-whonix:xfce4-terminal.anon-whonix:Xfce4-terminal -t 3
wmctrl -x -r anon-whonix:Navigator.anon-whonix:Tor Browser -t 3
wmctrl -x -r obsidian:obsidian.obsidian:obsidian -t 0
wmctrl -x -r bitwarden:bitwarden.bitwarden:Bitwarden -t 0
wmctrl -x -r personal:Navigator.personal:Firefox-esr -t 1
wmctrl -x -r qubes-qube-manager.Qube Manager -t 0
wmctrl -x -r xfce4-terminal.Xfce4-terminal -t 0

wmctrl -x -r bitwarden:bitwarden.bitwarden:Bitwarden -b add,sticky,hidden
wmctrl -x -r obsidian:obsidian.obsidian:obsidian -b add,sticky,hidden
wmctrl -x -r qubes-qube-manager.Qube Manager -b add,sticky
wmctrl -x -r xfce4-terminal.Xfce4-terminal -b add,sticky
  • The  first block of text moves each window to one of 4 different desktops.
  • The second block of text makes some of the windows visible on all workspaces and initially minimizes others.
  • You can throw the above code in to a shell script and run from dom0 terminal once all your  windows open after boot.

Conclusion

So everytime my system starts I just  have to wait a minute for all the qubes to start, all the apps to launch and then run my script from dom0. This makes the process of frequently shutting down m y machine much easier to deal with.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.