Get both pertag & bottom stack working in dwm

Published: by

  • Categories:

After I bought my Samsung N210 netbook, even though the Indian version of this netbook comes with 2GB RAM, I thought of trying Tiling Managers about which I had been listening since long on #archlinux. People generally use Window Managers instead if Desktop Environment because it lets you control everything using your keyboard & is also very low on resources.

So, I started with DWM (Desktop Window Manager). The first time when I was reading about it, I could not believe what I was reading from my eyes, it was written that you have recompile every time you want to change the configuration of DWM. Changing the configuration would require changing the source code.

I kind of thought why would I use it. But, still I tried. It took me around half an hour to figure out how to configure dwm & basic structure of dwm.c

I currently have dwm.c with bstack & pertag patch compiled. Well, if you are on this blog, you might already be having an issue of using both of these patches together.

Well, so download the source code of dwm from the official site. Also, download the two patches, bstack & pertag.

To apply the patch, first unzip the dwm tar file and then copy both patched in that directory. Now, the patched and dwm.c & config,def.h will all be in the same directory,

To apply the two patch, goto that dw. directory and type:

patch < dwm-5.8.2-bstack.diff 
patch < dwm-5.8.2-pertag.difff

Now, we will have a source code that would not compile. :(. Wait dont worry, there is a solution to that. To make the code compilable, make sure you have not included bstack.c in your config.h ie you should not have "#include "bstack.c" in your config.h file. Now, put "#include "bstack.c" just after struct Monitor{ … } in dwm.c Also, add the two prototypes,

static void bstack(Monitor *m);
static void bstackhoriz(Monitor *m);

in the prototype area. Now, the code is compilable.. :)

I am in love with this dwm, this is so light. I use cairo-compmgr as my composition manager to make it soothe my eyes.

Well, if you want my configuration files of dwm, here are those. I have done a lot of job configuring it for my Samsung N210. All the Fn keys, all shortcuts work perfectly with these settings.

Here is my DWM screenshot :-

DWM pre_startup script (startdwm.sh):-

#!/bin/bash
# Set up DE environment for apps that need one
export DE=xfce

#Enable Composition
cairo-compmgr &

# Autostart apps
dropboxd &
nitrogen --restore &
anamnesis --start #Clipboard Manager

# Start DWM and set status
while true ; do
xsetroot -name "wlan0: $(/home/shadyabhi/netbook/checkwireless.sh | awk '{print $1}') | blue: $(/home/shadyabhi/netbook/checkwireless.sh | awk '{print $2}') | BAT: $( acpi -b | awk '{ print $4 }' | tr -d ',' ) | VOL: $( amixer get Master | tail -1 |
awk '{print $4}' | tr -d '[]') | $( date +"%a %d %b @ %R" )"
sleep 1m
done &

.xinitrc file

#!/bin/sh
#
# ~/.xinitrc
#
# Executed by startx (run your window manager from here)

# exec gnome-session
# ck-launch-session startkde
# exec startxfce4
#DWM configuration

sh $HOME/startdwm.sh &
exec ck-launch-session dwm
#ck-launch-session awesome

#sh $HOME/startxmonad.sh &
#ck-launch-session xmonad
# ...or the Window Manager of your choice

config.h file here