💾 Archived View for l-3.space › dwm.gmi captured on 2024-08-18 at 17:32:58. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2021-11-30)

-=-=-=-=-=-=-

Time-stamp: <2020-09-04 15h31 EDT>

This post is part of my Qubes OS content.

Index of Qubes content

Why tiling

In the past i had favoured manual tiling window managers. The reasons for this are primarily:

These points certainly eliminate traditional, floating window managers from consideration. Historically i have found automatic tiling window managers to be unsatisfactory because the third point above.

Owing to these preferences i landed up using Ratpoison.

Ratpoison window manager

Ratpoison is a simple Window Manager with no fat library dependencies, no fancy graphics, no window decorations, and no rodent dependence. It is largely modelled after GNU Screen which has done wonders in the virtual terminal market.
The screen can be split into non-overlapping frames. All windows are kept maximized inside their frames to take full advantage of your precious screen real estate.
All interaction with the window manager is done through keystrokes. ratpoison has a prefix map to minimize the key clobbering that cripples Emacs and other quality pieces of software.

This was, i think, my first love and it will always have a special place in my heart. It is lightweight, manages windows exactly as i like them, has a modal leader key (yes!), and is entirely keyboard driven.

But then i learnt of Emacs and the temptation of power was too great. All roads lead to EXWM i'm sure.

EXWM

This allowed me to use Emacs as my window manager. There was much rejoicing, and i spent many hours ``optimising my environment for work'' (certainly many more than were ever spent working). Although i felt a pang of guilt for abandoning trusty Ratpoison for the frankenstein monster that was my sprawling Emacs setup, ... simulation keys!

EXWM has a built-in feature to translate certain, Emacs-style inputs into things the rest of the world can understand. C-n --> downarrow, for example.

Warning: these are dangerous habits to form because when they're gone, chaos ensues (i'm looking at you, Firefox, with your un-rebindable C-n for new window!).

Qubes OS, the one-way path

Unfortunately when i was thrust from my garden of Eden into the real world of misbehaving software and vulnerable applications the Emacs-for-everything dream had to end. Data separation and access control were the order of the day, and i simply could not run a flat environment like Emacs in the most trusted heart of my computer.

So i compromised.

That compromise was

DWM, the suckless window manager

If i truly had to minimise the attack surface of dom0, i would have to run a small, well-curated window manager which could be made to understand the border colouring and virtual machine separation of Qubes. These criteria left little room, and DWM emerged as almost the unique choice.

DWM

Of course, vanilla DWM wasn't going to work (at the very least, it didn't understand Qubes), and so i had to apply some patches, do some configuration, and write some supporting scripts. You can find the result of this effort here:

https://git.sr.ht/~tslil/qubes-dwm

Let's take a quick look at the various patches and scripts i'm employing in my setup.

Patches

autostart

Because Qubes uses LightDM for its login manager (and i'm too afraid to get rid of this), i couldn't employ the usual tricks of writing startup stuff to ~/.xinitrc . There might be some XDG-style way to do this, but simpler was to use the autostart patch which looks at ~/.config/dwm/autostart{,_blocking}.sh and runs these two scripts (waiting on the latter).

I use these to set keyboard layouts, start the screen locker, set the wallpaper, run xdg_autostart, and run the dwm status generator.

deck

As i mentioned above, i find that my laptop screen is too small to split into more than two regions. The solution to this for me is the deck layout. This allows me to have one large region for one window and one small region to display one of any of the remaining windows.

I don't know to what extent this counts as automatic tiling, but it's my preferred layout and the default one in the config.

pertag

It's helpful to have different layout schemes on different tags, and to be able to change the layout scheme without effecting other tags.

qubes

This is probably my raison d'être for using DWM. Someone already went through the motions of having DWM display the correct border colours for windows based on their VMs of origin, and to annotate the displayed title with this information.

rmaster

Apparently the DWM devs enjoy turning their heads to the left:

putting these things together means that i am staring at the left-most 30% of screen more than any other location. Reversing the side of the master region seems only natural.

systray

This one is fairly self-explanatory. DWM has a bar anyway, which i need to use to know the VM details for the currently focused window. I might as well take some of that space to display all those fancy tray icons (tomb-gtk-tray, pulse-audio, nm-applet for VPN and internet, Qubes-specific stuff about clipboards, ...).

Scripts

My DWM configuration is held together by scripts and hope. As is customary for DWM setups, i'm using dmenu to launch applications. There was a fair bit of fiddling involved in setting this up sanely.

I want the suggested list of programmes to be extracted from a list of .desktop files relevant to the VM of the currently active window, and i'd like the colours to match too. This is implemented by scripts/dmenu_cur and its helpers. The rest is all fairly straightforward stuff about locking the screen, generating a status-line, and parsing autostart entries.