My dwm Setup

Table of Contents

1 Description

dwm is a X window manager. This page describes how I have set up dwm to suit my needs. Its indented audience is me a few months from now when I have forgotten all this stuff.

2 News

  • 26 Aug 2013: Initial site.
  • 27 Aug 2013: patch systray and (I think) opera uses 100% cpu when switching tags. Switched to using trayer instead.

3 dwm patches

dwm does what it needs to and not more. I need it to do slightly more than it needs, so I apply a ready-made patch.

  • pertag : This patch remembers layouts for tags.

4 dwm config.h

Here the patch download: dwm_config.h.diff. The changes are:

  • Use Window-key instead of Alt (for my keyboard)
  • Only show 6 tags
  • Win-SPACE as dmenucmd (default Alt-p)
  • Alt-Tab as switch between open applications (default Alt-j)
  • Alt-F4 as kill current application (default Alt-Shift-c)
--- config.def.h        2011-12-19 16:02:46.000000000 +0100
+++ ../config.h 2013-08-26 19:17:47.942433764 +0200
@@ -17,1 +19,1 @@
-static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
+static const char *tags[] = { "1", "2", "3", "4", "5", "6" };
@@ -38,1 +40,1 @@
-#define MODKEY Mod1Mask
+#define MODKEY Mod4Mask
@@ -69,2 +71,0 @@
-       { MODKEY,                       XK_space,  setlayout,      {0} },
-       { MODKEY|ShiftMask,             XK_space,  togglefloating, {0} },
@@ -86,1 +86,4 @@
        { MODKEY|ShiftMask,             XK_q,      quit,           {0} },
+       { Mod1Mask,                     XK_Tab,    focusstack,     {.i = -1 } },
+       { MODKEY,                       XK_space,  spawn,          {.v = dmenucmd } },
+       { Mod1Mask,                     XK_F4,     killclient,     {0} },

5 xsession desktop dwm.desktop

/usr/share/xsession/dwm.desktop

[Desktop Entry]
Name=dwm
Exec=/home/bin/dwm-init

6 System tray

I need the system tray to access the gnome network manager for my usb mobile modem (use wicd if you don't have fancy network connectivity devices).

When I need the system tray I launch trayer, do stuff and close it again.

7 dwm initialization script

My initialization script does the following:

  1. Increase key repeat speed
  2. Disable screen power saving settings
  3. Disable screen blanking
  4. Set background to a dark grey color
  5. Set up keyboard layout as US english (or danish when Alt Gr is pressed)
  6. Disable trackpad tap counts as click
  7. Enable the xfce volume controller (which somehow picks up my keyboard volume buttons)
  8. Run Gnome's Network Manager
  9. Start my status-bar updater
  10. Start my mail checker

~/bin/dwm-init

,#!/bin/sh

xset r rate 250 30
xset -dpms
xset s off
xsetroot -solid darkgrey
setxkbmap -option grp:switch us,dk
synclient TapButton2=
xfce4-volumed
nm-applet &

dwmstatusda > ~/dwmstatusda.txt &

mailchecker &

dwm

7.1 Mail checker

See my mail setup guide at Emacs, notmuch, offlineimap and Gmail email system.

~/bin/mailchecker

#!/bin/sh

while [ 1 ]; do
      offlineimap && notmuch-my-new
      sleep 60
done

7.2 My dwmstatus updater

dwmstatus sets a user-defined text that is shown in the top-right corner of the screen by dwm.

My dwmstatus updater is available here dwmstatusda.c.

dwmstatusda outputs statuses like this one:

,72C 31 9012 M Mon 26 Aug 19:56
,\-/ || \--/ | \--------------/
, |  ||  |   |        |
, |  ||  |   |        \-------> The time and date
, |  ||  |   \----------------> Whether I have unread mail
, |  ||  \--------------------> Single-digit percentage representation
, |  ||                           of the usage of my 4 cpu cores.
, |  ||                           (0 = 0-9%, 1 = 10-19%, 9 = 90-100%)
, |  |\-----------------------> Single-digit percentage of swap usage
, |  \------------------------> Single-digit percentage of memory usage
, \---------------------------> The temperature of my computer (Celsius)

Author: Dan Amlund Thomsen

Created: 2019-05-09 Thu 19:53

Validate