dwm Theme Configuration^
Users familiar with desktop environments, especially KDE and XFCE, may be used to an abundance of configuration options that allow for precise theming to make every application look just the way they like. Users more familiar with GNOME may be used to a lack of choice in this area until they find their way into the various hacks and tweaks that make these options available.
Most window managers operate from the perspective that they should get out of the way to keep from distracting you from whatever application you happened to be running. XMonad, for instance, opens on a blank screen.
When you start X with the default configuration of dwm, you get a plain bar at the top of the screen that tells you which tag you’re on, the title of the active application, and the present version of dwm. Windows open with a small border but no title bar and the colors are pretty basic.
There isn’t much available by default, but as you add features to dwm you may find opportunity for further theming and development.
Color Settings^
There are five colors defined by default in the config.h
file. These controls the colors used on window borders, the
status bar, and the values passed into dmenu
when the command is called.
10static const char col_gray1[] = "#222222";
11static const char col_gray2[] = "#444444";
12static const char col_gray3[] = "#bbbbbb";
13static const char col_gray4[] = "#eeeeee";
14static const char col_cyan[] = "#005577";
You can modify these colors to new values or add new colors to the scheme, but these are the variables in use by default.
Border Settings^
There are three settings that control window borders:
borderpx, snap, and colors .
By default, dwm does not feature any form of window title, though the top bar does display this information if you need it.
Border Size^
The borderpx integer indicates the number of pixels to show
on the borders of windows. It defaults to 1 pixel, but you can
set it to any reasonable unsigned integer.
4static const unsigned int borderpx = 1;
The specific setting that you should use comes down to personal preference. Some users like to have a bold border around their windows, so that it more clearly defines where one ends and the other begins, with a clear color designation for the active window. Some (read: me), prefer a thin sliver that stays out the way.
Border Snapping^
When using the floating window layout, a snap occurs when you
move a window close enough to another that it jumps over as
though to attach itself to the other. The distant between two
windows before they snap is controlled by the unsigned integer
snap, which defaults to 32 pixels.
5static const unsigned int snap = 32;
Personally, I avoid floating windows. My own preference is to swap between tiling and full screen layouts and keep floating to limited ad hoc usage.
Border Colors^
The colors array controls how dwm handles colors based on
whether the windows are active or inactive.
|
Refers to the base colors used by inactive windows. |
|---|---|
|
Refers to the colors used by active windows. |
Each type takes three values. The first indicates the foreground color of text. The second, the background. And, the third, the border color.
15static const char *colors[][3] = {
16 /* fg bg border */
17 [SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
18 [SchemeSel] = { col_gray4, col_cyan, col_cyan },
19};
Unless you have a particular look and feel in mind, the defaults are usually sufficient for someone who is just getting started. As you build out features on other Suckless tools, you may decide to rework this code so that all the applications have themes that match the window manager.
Status Bar^
Unlike XMonad, dwm ships with a default status bar. The content
of the status bar is retrieved from the WM_NAME X property,
which you can set with the xsetroot or xprop commands.
See also
Note that there are alternative status bars available.
Suckless maintains two: slstatus and dwmstatus, you
can also run a narrow Conky instance to accomplish the same.
All of these options will be explored in much more detail in
separate sets of articles on the Knowledge Base.
That said, the default status bar is good enough for government work.
Status Bar Visibility^
The showbar variable controls the visibility of the status
bar. It is a simple integer constant where 1 indicates that
you want to see the status bar and 0 indicates dwm should
hide it.
6static const int showbar = 1;
If you don’t like having a status bar or would like to remove it to make room for one of the alternatives, set it to 0.
Status Bar Position^
The position of the status bar is controlled by the topbar
variable. This is a simple integer constant where 1
indicates that it appears at the top of the screen while 0
indicates that you want it at the bottom of the screen.
7static const int topbar = 1;
This one comes down to personal preference and functionality.
What information do you have in the status bar? When active,
consider where your eye wants to go to look for this
information. If you find yourself glancing down when you want it
before looking up to where it lives, consider setting topbar
to 1.
Font Configuration^
There are two variables used to configure fonts. The first is
the fonts variable, which is used generally throughout dwm,
most noticeably in the status bar.
The second is the dmenufont variable, which you can see from
the name is used to configure font usage by dmenu. This string
is passed into dmenu through a command-line argument specified
below.
8static const char *fonts[] = { "monospace:size=10" };
9static const char dmenufont[] = "monospace:size=10";
In my own build, I have kept monospace, but upped the font size to 18 to make the text easier to read on a 4k monitor.