dwm on duty ‒ Part 1

Recently I switched to dwm from XMonad. It’s not that I am unhappy with XMonad in any way, I just wanted to see what all those alternatives out there are capable of and if there is something that might suit my needs in a better way. So, dwm is my first stop.
So, the first thing I noticed – beside some key bindings being different – is the configuration concept. It’s not too different to that used by XMonad, however it’s a bit more inconvenient. Whereas XMonad offers a comfortable restart function, you won’t find that in vanilla dwm. In fact, you won’t find the most functions you know from XMonad in dwm, but I guess thats part of suckless’ philosophy to keep things small and tiny to not make them too complicated. Anyway, for dwm you have to setup the configuration file (config.h), recompile the program, then restart it. The same what XMonad does, just by hand. This made me create a handy start script i am using to start dwm in a loop:

First, ignore the first loop. It one is just there to infinitely update dwm’s status bar. Nothing to care about now. The second loop is what I wanted to point out here. It’s nothing too special. All I do is to start dwm in a loop so I can recompile dwm, kill it and the new version will be started automatically.

Ok. Now that I had this set up I could easily change some key bindings, recompile, restart dwm and wow, it already felt a bit more familiar. Rebinding the keys is really not big of a hassle, just edit config.h. Even if you are not into (C-)programming you should figure out how it works. But well, that’s not even half of what has to be done to make dwm feel right to me…

The next thing I noticed was the tag concept. I just installed dwm from the repos and didn’t do any previous research about dwm, so this really caught me off-guard. I was used to XMonad’s workspace concept and this new thing was the first big difference and  somehow instantly felt  like it could be useful sometimes. What you know from XMonad is, that can define any number of workspaces and all windows can be bound to one workspace at a time. dwm works differently. Each window can be tagged and if your keys you toggle the visibility state of all windows that are associated with a certain tag. The main difference is, that a windows can have more then just one tag.

Since I didn’t really have a workflow profiting from it (yet?), I still wanted XMonad’s workspace behaviour with the option to use the tagging concept if I want to. My plan was to define a set of tags representing my workspaces in XMonad: “base” “web” “chat” “notes” “mail” “scratch”. Then I rebound the default switching keys to not only toggle the state of a tag’s visibility but also to set all other tags to invisible and to explicitly toggle a tag’s visibility without changing the other’s states I have to hold shift in addition. As long as I just bind a window to one tag, I get the workspace concept back. And if I am really in the mood to bound I a window to several “workspaces” I am free to do so. Furthermore I can display “one workspace into the other” by activating two tags.

Ok, that’s all for today folks. For now, it’s enough to get the last idea of how to mimic “workspaces” with “tags”. In my next post on this topic I will explain what other changes and patches I put in my dwm configuration and how this made it really a nice replacement for XMonad, … at least for now.

dwm on arch linux

This is what I finally got. Check out my next post for more pieces of the configuration.

Leave a Reply

Your email address will not be published. Required fields are marked *