How many of you use dwm?

Thanks for the info!

ok just figured how to do the volume and brightness keys work!

if that helps,

  1. installed sudo pacman -S xorg-xbacklight
  2. edit dwm-6.2/config.h file
  3. add #include <X11/XF86keysym.h> on top of the file
  1. below /* commands */ add the following to define what each key will do
// Volume Commands
static const char *mutemic[] = {"/usr/bin/pactl", "set-source-mute", "@DEFAULT_SOURCE@", "toggle", NULL }; 
static const char *upvol[] = {"/usr/bin/pactl", "set-sink-volume", "0", "+10%", NULL };
static const char *downvol[] = {"/usr/bin/pactl", "set-sink-volume", "0", "-10%", NULL };
static const char *mutevol[] = {"/usr/bin/pactl", "set-sink-mute", "0", "toggle", NULL };
// Brightness Commands
static const char *brightnessup[] = { "xbacklight", "-inc", "5"};
static const char *brightnessdown[] = { "xbacklight", "-dec", "5"};
  1. under Key /* modifier add the keybindings
    { 0,                            XF86XK_AudioMicMute, spawn,      {.v = mutemic } },
    { 0,                            XF86XK_AudioLowerVolume, spawn,  {.v = downvol } },
    { 0,                            XF86XK_AudioRaiseVolume, spawn,  {.v = upvol} },
    { 0,                            XF86XK_AudioMute, spawn,         {.v = mutevol } },
    { 0,                            XF86XK_MonBrightnessUp,   spawn,          {.v = brightnessup} },
    { 0,                            XF86XK_MonBrightnessDown, spawn,          {.v = brightnessdown} },
  1. recompile

You kind of did motivate me to step my :poop: up with my idea of Awesome.


Nice suckless setup (no patches). I guess the last thing needed is an indicator for network traffic/wifi name.


Build it they will come

dwm is cool & easy to set up


Not so sure about the easy part, I have dabbled the past week in dwm, awesome and qtile. The latter two are definitely easier to read and understand in terms of coding language. I gave up on lua and think will rather stick with python since it’s also a language I want to learn further.

I broke my dwm setup above :pensive: by applying two patches and am left clueless of how to fix it. Just tried to apply a uselessgap patch from the suckless website then remove it to try another of their patch as the gaps were buggy. Patches seem to alter not only the main config file and not sure how to manually fix things in C and which file. So in a way the main config is short but to add additional features in dwm requires adding scripts or patches.

They will come? :alien:

BTW welcome to the forum! :grin:

If a patch fails, you can either apply it manually or reverse it with patch -R < name-of-patch. To patch manually after a fail just look at the .rej file and apply accordingly.

Thanks so much for the comment. I actually did try to remove the patch, that is when I broke it. So what is the .rej file exactly saying. Would I go to my file, for example dwm.c and re-add and remove things shown in that .rej file. Does +++ mean what has been added and — what has been removed and I would have to reverse that.

Here is an example for dwm.c.rej

--- dwm.c
+++ dwm.c
@@ -119,7 +119,6 @@ struct Monitor {
 	int by;               /* bar geometry */
 	int mx, my, mw, mh;   /* screen size */
 	int wx, wy, ww, wh;   /* window area  */
-	int gappx;            /* gaps between windows */
 	unsigned int seltags;
 	unsigned int sellt;
 	unsigned int tagset[2];
@@ -200,7 +199,6 @@ static void sendmon(Client *c, Monitor *m);
 static void setclientstate(Client *c, long state);
 static void setfocus(Client *c);
 static void setfullscreen(Client *c, int fullscreen);
-static void setgaps(const Arg *arg);
 static void setlayout(const Arg *arg);
 static void setmfact(const Arg *arg);
 static void setup(void);
@@ -640,7 +638,6 @@ createmon(void)
 	m->nmaster = nmaster;
 	m->showbar = showbar;
 	m->topbar = topbar;
-	m->gappx = gappx;
 	m->lt[0] = &layouts[0];
 	m->lt[1] = &layouts[1 % LENGTH(layouts)];
 	strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
@@ -1500,16 +1497,6 @@ setfullscreen(Client *c, int fullscreen)
-setgaps(const Arg *arg)
-	if ((arg->i == 0) || (selmon->gappx + arg->i < 0))
-		selmon->gappx = 0;
-	else
-		selmon->gappx += arg->i;
-	arrange(selmon);
 setlayout(const Arg *arg)
@@ -1696,16 +1683,16 @@ tile(Monitor *m)
 	if (n > m->nmaster)
 		mw = m->nmaster ? m->ww * m->mfact : 0;
-		mw = m->ww - m->gappx;
-	for (i = 0, my = ty = m->gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
+		mw = m->ww;
+	for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
 		if (i < m->nmaster) {
-			h = (m->wh - my) / (MIN(n, m->nmaster) - i) - m->gappx;
-			resize(c, m->wx + m->gappx, m->wy + my, mw - (2*c->bw) - m->gappx, h - (2*c->bw), 0);
-			my += HEIGHT(c) + m->gappx;
+			h = (m->wh - my) / (MIN(n, m->nmaster) - i);
+			resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0);
+			my += HEIGHT(c);
 		} else {
-			h = (m->wh - ty) / (n - i) - m->gappx;
-			resize(c, m->wx + mw + m->gappx, m->wy + ty, m->ww - mw - (2*c->bw) - 2*m->gappx, h - (2*c->bw), 0);
-			ty += HEIGHT(c) + m->gappx;
+			h = (m->wh - ty) / (n - i);
+			resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0);
+			ty += HEIGHT(c);

If you patch DWM and the patch fails it will generate one or two .rej files. In my experience, the easiest one to deal with is a config.def.h.rej file. Open that file and it will tell you which lines of the original config.def.h file need changing. A minus sign at the beginning of the line means ‘remove that line’ and the plus sign means ‘add that line’. It should be fairly easy to do that in the config.def.h file. Sometimes the patch on dwm.c fails, so the dwm.c.rej file shows the minus and plus lines to change. Manually changing the dwm.c is not so easy. You have to find the lines and make sure that you aren’t also altering either the wrong line or losing a part of the line that was created by an earlier patch.
I recommend watching a demonstration on YouTube. There are plenty of videos showing this process; try under the name distrotube. He is good.
I also recommend that you try out a couple of simple patches and even try patching them manually by reading the .diff file. There is also a project called dwm-flexipatch which will do the patching for you. There are one or two videos on YouTube to show you that. It works for a few simple patches but will discard patches it doesn’t like. I don’t like it but some linux users do.

1 Like

Thanks for the tips! I frequently watch distrotube, but didn’t watch yet all of the dwm ones. I like dt.

I have used dmw for some years with only a few patches and have a hard time switching to something else. In the past, I have periodically used awesome, xmonad and also tested leftwm, but as I said dwm suits me and my machines best.

See screenshot from today.

And good morning from Sweden!


I’ve used DWM for a couple of years now and it’s my favoured WM. Currently playing with flexipatch and it certainly make life easy


Apply the auto start patch and start dwm blocks from there. Should work from your .xinitrc though


Will try that, I am not familiar with this patch.

1 Like

FWIW new versions of dwm &s st plus a few other items have just been released. See: