The Gregory Jay Blog



A week with DWM

It's been a week or so since I installed DWM and I am, on the whole, happy with it. In fact, so much so that I take back all the horrible things I said about it last week! I'm seeing now how configurable it is and how useful the patching system, rather than the config system, really is.

It was a rocky start I must admit, not knowing how to configure anything and looking at a list of C files that I couldn't read did, at first, make me feel like the only way I was going to be able to configure DWM was by learning C and essentially coding in the features I wanted. Luckily this was not the case!

Patching DWM

Window managers I have used in the past were configured by making changes to a config file of one type or another and reloading the WM. DWM doesn't work this way. There is a config file but there is not a huge amount of configuration possible with the config file alone. Keybinds, fonts, colours and workspace/tag names can be changed here but not much of anything else. How then do we change the behaviour of the WM? This is where patching comes in! Want to change to the next workspace/tag? You need a patch for that. Want to have different colours for the bar and window border? Yoe need a patch for that. Hide the unused tag? Patch. Cycle through your layouts? Patch. Want a scratchpad? Patch.

At first it does seem inconvieniant to have to patch in every little feature you want. However, in reality patching DWM is, in threory at least, quick and easy - download the patch and install it with one command. There is some artistic beauty in this methodology. Why have features you don't need? In DWM you are getting the bare bones of a window manager, a stripped down version that's snappy and ready to be molded to your specificiation. I don't want to see my unused tags because I'm used to that feature from i3 but there is no need to build this in to DWM when most people wont want it. Most people will want to cycle through the layout options but still, there is no reason to build this into DWM when some people wont want it. The bottom line is if you want a feature - patch it in!

So here is what I have patched in:

Tag Cycling

This is a the only way I move from tag to tag. Instead of hitting mod+5 to go to tag 5, I use mod+h or mod+l to cycle back or forewards through my tags till I get to tag 5. This does seem like more key presses but it does have some advantages. I don't need to reach up to the number row, my fingers stay on the middle row and the furthest I ever have to travel is 4 tags (say from tag 1-5) which is four key presses. The other advantage and the real reason I like this setup is that I can have another funtion for my mod+numbers - opening a program on that tag.

I like to have my browser on tag 2, my image editing software (darktable) on tag 3, my file browser on tag 4 etc. I've had my window manager set up this way for years and really wanted to recreate it on DWM. I just needed to add a keybind for mod+2 to my config to open my browser and DWM would go to tag 2 and open the browser. I do this for all my most commonly used programs.

Title Color

This is a purely cosmetic patch. DWM's standard behaviour is to outline the active window in the same colour as the background of the active tag and background of the window title. The title color patch allows you to change each of these individually. I wanted the whole of my bar to be black, which I could do but it also made the active window border black, that made it difficult to see which window was active when I had multiple open windows. Now I have my all black bar with a purple border around my active window just as I wanted it.

Hide Vacant Tags

This is really just something I am used to having from i3 but I do think it's useful. By default DWM shows all the tags in the panel at the top, this patch only shows them if they have an open window within them.

Configuring

With all the patches done I only had a little configuring left to do. Most of this configuring was fairly painless, in fact I don't think I had any real problems with this. It really just came down to theming, the panel and keybindings.

Yes, theming not 'ricing,' I don't know why but the term seems a little too much like the tech equivalent of 'let me take a selfie with my food before I eat it.' Everyone configures they're system to some extent but people only use the word when they are doing it to show off, or at least that's how it seems. I have lived in China for the last 13 years and so most of the social media world has passed me by. I have no twitter or snapchat, discord remains a mystery to me. I have used facebook in the past but I never had it installed on my phone (I still don't see why anyone would need it on their phone) and so I have never felt the urge to take selfies or pictures of my food. When I see something interesting I look at it unlike everyone else who pull their phones out first and take pictures of it (I used to not understand when they would get the chance to sit down and look at all these pictures, then I realised that the pictures they take are not for themselves to look at or to remember the moment, no, they are to put up on instagram to garner likes for God know what.) oops I'm ranting.

Anyone familiar with window managers will have replaced they're workspaces or tags with awesome font icons, and that's what I did. Instead of using icons like  or  for tags where you usually open the file manager or browser, I decided to just use silly icons like bacon  , a dragon  , and a ghost  , because why not? Then I set the font colours to purple and green, the backgrounds to black and the borders to purple. I found a nice purple and black wallpaper to match. Theme done!

The panel

I chose dwmblocks as my panel, mostly on the recommendation of Luke Smith. It has some advantages over the default panel that comes with DWM. You can set the reload frequency of each individual module and send signals to it to force it to update a certain module. Neither of these are possible with the default panel. Obviously your cpd usuage reloaded constantly while it would be a waste to update the package updates, the date or in my case the pm2.5 levels for the city I live (the data itself is updated every hour so I reload that module ever 30 mins or so) that frequently. Sending a signal is useful to force the module to update for things like, displaying the volume, it only updates when you change the volume and give it the signal rather than it checking every second or somesuch frequency.

Finally the keybindings

The ability to bind keys for my most frequently used tasks is one of the main reasons I switched to a window manager from a full desktp enviroment in the first place. Not that you can't bind keys in a desktop enviroment, of course you could, but WMs are built with binding keys in mind. I think that once you are used to having keybindings most of the icons and menus and other ui elements just seem redundant and in the way. I really needed keybindings for the following functions:

  • Changing tags and opening programs
  • takign screenshots
  • Running scripts for brightness, volume, vpn, password manager, browser bookmarks, opening file/web browsers, shutdown, dmenu, youtube-dl, music search
  • Moving windows etc
  • Changing tags and moving windows is already setup in the config and so making small changes to them is fairly easy. I did have to go online to check how to open applications and run scripts though, not intuitive but once you know, easy enough. The last buttons I managed to get working were my brightness buttons which I was especially pleased about as I had had full brightness shining at me for about 2 weeks straight at that point.

    Now that everything is setup more or less the way I want it, I am really happy with DWM and will probably install it on my main machine too, eventually

    Feel free to take a look at my github here to see my config.h file.

    Greg is a true Sinophile, fluent in Chinese and proficient in Tibetan he is a homeschooling Dad that also consults on the side. You'll often find him cigar in mouth, book in hand, waiting for someone to finish their work or for the coffee to brew.

    17.04.2021  

    Homeschool Redesign

    Education

    Since moving into our new house we never really settled on where we should be doing all of our homeschooling and sometimes we've lost momentum because of it. It's time I redesigned our homeschool!


    14.04.2021  

    Dharamsala

    Album

    Photos of Dharamsala


    14.04.2021  

    Tan Zhe Temple

    Album

    Photos of Tan Zhe Temple


    11.04.2021  

    Keto in China is easy!

    Blog

    I have been doing keto here in China for over 3 years now and I'm convinced it's easier here than anywhere else.


    09.04.2021  

    Tianjin TV Tower

    Album

    Photos of the Tianjin TV Tower


    03.04.2021  

    Why we use the Classical Model

    Education

    I was recently asked why ew use the classical model for homeschooling our son - this is what I meant to say.


    03.04.2021  

    Cigars - The Best Medicine

    Blog

    Having been a cigar smoker for well over a decade now, I see that it really is the solution for all of life's woes. Well maybe I wouldn't go quite that far but I always feel positive and energised after a good cigar, and maybe not for the reason you think.


    19.03.2021  

    New Tab Perfection

    Linux

    Having more control over what shows up when I open a new tab and the way it shows up is a part of my workflow that I had been overlooking. I've recently brought it in line with Unix philosophy of 'do one thing and do it well.'


    17.02.2021  

    Getting Things Done

    Blog

    A Rambly blog about how I use GTD and how my system has changed over the years.


    17.02.2021  

    Winter 2020

    Album

    Us over Christmas and winter 2020


    04.02.2021  

    The Crumpet Business

    Blog

    I managed to to start a crumpet business almost by accident, but it's going well and orders are still coming in daily!


    03.01.2021  

    Deciding on a New Year's Resolution

    Blog

    This year I had trouble trying do think of a New Year's resolution, not that I necessarliy need one but it is good to give the year some direction and to have something to focus on. I think I might have found something now though


    06.12.2020  

    My Password Manager

    Linux

    Long ago I gave up using someone else's password manager, hoping that they would keep my most sensitive data safe and protected and decided to create my own.


    05.12.2020  

    Why We Homeschool Part 1

    Education

    This post ended up longer than I had intended so I have split it up into two sections. This is the first. Why we homeschool: Problems with the education system.


    05.12.2020  

    November 2020 Album

    Album

    This post ended up longer than I had intended so I have split it up into two sections. This is the first. Why we homeschool: Problems with the education system.


    23.11.2020  

    DWM is configured!

    Linux

    The process of setting up DWM has really brought me round to the 'suckless way' of patching rather than configuring, this is a post about me going through the process of setup, patching and configuration of my nice new window manager.


    20.11.2020  

    Building an History Curriculum

    Education

    I am currently in the throws of creating a new history curriculum, from scratch, for my homeschooler. In this post I talk about the reasons why I have decided to do such athing and the problems that I have already hit even though I haven't even started yet.


    19.11.2020  

    Productive Procrastination, Well Kinda...

    Blog

    After deciding to start updating my website a little more regularly I, instead of actually doing it, procrastinated for a week or so, productively I assure you!


    18.11.2020  

    Configuring DWM

    Linux

    After installing DWM, I am undecided as to whether to stick with it or not. I though i'd use this blog post as a way to think through the decision.


    13.11.2020  

    A new wm (Window Manager)

    Linux

    I'm a list maker! Almost every decision I make requires me to make a list. Here I make a list on what I don't like about i3, my current window manager and what I want out of a new one, hopefully I'll choose one after this!


    05.12.2020  

    The Train Tracks 2020 Album

    Album

    This post ended up longer than I had intended so I have split it up into two sections. This is the first. Why we homeschool: Problems with the education system.


    05.12.2020  

    Lockdown! 2020 Album

    Album

    This post ended up longer than I had intended so I have split it up into two sections. This is the first. Why we homeschool: Problems with the education system.


    05.12.2020  

    Back to Normal! Album

    Album

    This post ended up longer than I had intended so I have split it up into two sections. This is the first. Why we homeschool: Problems with the education system.


    05.12.2020  

    Summer 2020 Album

    Album

    This post ended up longer than I had intended so I have split it up into two sections. This is the first. Why we homeschool: Problems with the education system.


    05.12.2020  

    October 2020 Album

    Album

    This post ended up longer than I had intended so I have split it up into two sections. This is the first. Why we homeschool: Problems with the education system.