Dwm

dwm (shortened from dynamic window manager) is window manager for X11 from suckless.org.]] dwm is only a single binary, and its source code is intended to never exceed 2000 SLOC.

dwm is configured by editing C source code, and recompiling. The suckless website states that the project focuses on advanced and experienced computer users, and - perhaps tongue in cheek - that customization through editing source code "keeps its userbase small and elitist".

Window model
dwm is a dynamic window manager, as such it manages windows in tiled, monocle and floating layouts. All of the layouts can be applied dynamically, optimizing the environment for the application in use and the task performed.

Launch a few terminals with ++ and dwm will tile the windows between the master and stack. A new terminal appears on the master window. Existing windows are pushed upon a stack to the right of the screen. + toggles windows between master and stack.

+--+--++   | tags | title                            | status + +--+-+++   |                            |                     |    |                            |                     |    |                            |                     |    |                            |                     |    |          master            |        stack        | |                           |                     |    |                            |                     |    |                            |                     |    |                            |                     |    ++-+

USE flags
Users should consider enabling the  USE flag in order to save customized configuration file to  for later editing.

Users with multiple monitors should enable the  USE flag regardless of whether or not Xinerama will be used.

Emerge
Install :

Starting
To start dwm use a display manager or the command.

Those choosing to go the route create the following file:

Main dwm configuration file (dwm.h file)
As stated previously, the main dwm configuration file is the file and after each change, dwm needs to be recompiled for any changes to take effect.

In order for the editor to use syntax highlighting feature for C code, create a symlink using a header filename.

(When already within a dwm session and just recompiled dwm, use the ++ key sequence for reloading the dwm binary currently executing within memory.)

Settings file (dwm.rc)
The default xsession file provided by the Gentoo Ebuild provides for a default status box that displays system load and the date/time or whatever shell code the user creates at. The present mechanism (as of dwm-6.0) for sending text to a status box in the window manager's bar is to use 'xsetroot', as illustrated by the default xsession mentioned above. With a few lines of shell code, one can use this mechanism to send arbitrary text to the status bar (for example, the CPU temperature, the current track on the music player, number of unread emails, etc.)

dmenu
dmenu is a dynamic menu for X, originally designed for dwm.

Emerge
Install dmenu:

Configuration
dmenu's options can be customized using the file, such as displaying the menu at the bottom of the display.

Usage
(aka META) + key sequence enables the menu.

Additional status information
For displaying additional status information on dwm's menu bar, one should use, which sets text information into upper right corner.

First of all, install if it's not installed yet.

Then, use a script or side program to loop current info in dwm status.

Conky
For example, try Conky to display current information about the system. Prefer installing with  USE flag as only text information is piped through to the dwm instance. (USE flags for consideration are "-X hddtemp iostats wifi".)

An example file. Top file are Conky related options, while the TEXT section are printed results. The TEXT section is usually system specific and likely will need further editing to run properly.

Add a line in file before the dwm execution command, mentioned earlier.

Custom script
Instead of emerging side programs, create a simple loop to show date, time, weather and other system info.

For example, to show weather, date and time create a script file, in for example:

Since the script is already looped, we just need to set it within xroot in our file.

Keys and key functions
is the default META key

Moving a window manually
To move a window to another window tag manually, hold down the META key and left click anywhere on the window. And then, while still holding down the META key, click again on the window tag want to move the window to.

Default shortcuts
Those shotcuts are used by default in x11-wm/dwm.

Window management

 * + - Display window tag number two
 * ++ - Hover mouse over window and press keys. Puts window on tag number specified.
 * ++ - Hover mouse over window and press keys. Puts window on all tags.

Utilities

 * ++ - Launch a terminal
 * ++ - Kills a window
 * + - dmenu
 * + or + - Move to another terminal.
 * + - Toggles Windows between stack and master.
 * ++ - Quit dwm

Changing layout

 * + - Change layout on floating.
 * + - Change layout on tiled.

Volume keys
Add following lines to the config file and re-emerge dwm:

{{FileBox|filename=/etc/portage/savedconfig/x11-wm/dwm-6.0|lang=c|1=
 * 1) include 

...

/* commands */ static const char *upvol[] = { "amixer", "set", "Master", "2+", NULL }; static const char *downvol[] = { "amixer", "set", "Master", "2-", NULL };

// for muting/unmuting // static const char *mute[] = { "amixer", "-q", "set", "Master", "toggle", NULL };

// for pulse compatible // static const char *upvol[] = { "amixer", "-q", "sset", "Master", "1%+", NULL }; static const char *downvol[] = { "amixer", "-q", "sset", "Master", "1%-", NULL }; static const char *mute[] = { "amixer", "-q", "-D", "pulse", "sset", "Master", "toggle", NULL };

...

static Key keys[] = { /* modifier                    key        function        argument */ { 0,             XF86XK_AudioRaiseVolume, spawn,          {.v = upvol } }, { 0,             XF86XK_AudioLowerVolume, spawn,          {.v = downvol } }, { 0,             XF86XK_AudioMute,        spawn,          {.v = mute } }, }}

Customization
dwm is customized through editing its source code

(Put user customization tricks & tips here.)

Patching
Gentoo has a specific way of patching dwm. If the patches are ready to be merged with dwm source, there is special function called  that can be called during the emerge process. This function allows user patches to be applied to the source. Move the necessary patches one of the two locations:


 * /etc/portage/patches/category/application
 * A custom ebuild repository

Patches in /etc/portage/patches/category/application
First create the following directory:

Copy the dwm patches to and make sure each patch is prefixed with a number, like so:. Also the file needs to be named *.patch or *.diff otherwise Portage will not apply it. For this example we will assume that patch is located in the user called larry's ~/ (home directory).

Now just install dwm, emerge will take care of applying patches

Patches in a custom ebuild repository
Copy x11-wm/dwm from to the custom repository, for more information how to create custom repository see the Custom ebuild repository article.

Next we need to place our patches in files directory.

Open or whatever location of custom repository and list them in the PATCHES variable array for automatic patching.

Fire up emerge and enjoy

Assigning applications to window tags
A user can have their favorite applications start on a different window tags, such as starting mplayer on window tag number five.

First, know the "name" of the application recorded by Xorg so dwm can be aware of this window on startup. To find this, start an application (mplayer in this example) and then further execute a command called "xprop". Click on the mplayer window and xprop will report Xorg's data on the mplayer window. Use the second window name identified on the "WM_CLASS(STRING)" line. Now we have the name of the window dwm needs to be self aware of. (Sometimes an application will have multiple windows of itself and will report one window without capital letters, while the second will have no capital letters! Wildcard char is allowed within window names and I currently have no idea how many regular expressions are recognized here.)

Upgrading to dwm-6.0
Upgrading from dwm-5.9 to dwm-6.0 incorporated many changes making the previous a likely problem for compiling dwm-6.0. Likely problems displayed might be compiler error messages "[nowiki]'nmaster' undeclared[/nowiki]". To resolve, compile and install dwm-6.0 without using the custom file and then find the default dwm-6.0  file and diff against the old  file. (Or, uncompress the dwm-6.0 tarball to acquire the default dwm-6.0 file.)

Remap META Key
If there are conflicts with the default dwm ALT key conflicting with other console interface applications, use the ESC key while within the console application. The ESC key is an immediate usable fall back escape key. Another option, redefine the META key to use the keyboard "Windows Key" or other additional keys near the space bar.

To assign a second Meta key allowing a typer to have a Meta key on both sides of the keyboard, mimmick or copy this key activity to another key on the keyboard. The Microsoft Menu key (or context menu key) on Microsoft keyboards is directly opposite of the Microsoft Windows key. The package is required for this. (For reference, the two key's values are: "showkey 125/127" and "xev 133/135" respectively - on my MS NEK4000 keyboard.)

xmodmap -e "keycode 135 = Super_L" # reassign MS Menu Keypress to Super_L xmodmap -e "remove mod1 = Super_L" # make sure X keeps it out of the mod1 group
 * 1) Top of $HOME/.xinitrc file is a good place for this.
 * 2) This reassigns MS NEK4000 right Menu key to simulate DWM Mod4Key as well.

Now, a user should have a non-conflicting and easily accessible Meta key on both sides of the keyboard!

Fix Java application misbehaving
Java application are known to misbehave as java doesn't know which WM are we using. After all this result in GUI of specific java application to don't work properly. To solve this we need to install wmname tool and set it to LG3D.

and set it to

To make this setting permanent add this command to.

It is also useful to export AWT_TOOLKIT if some java applications are using AWT, as noted below.

Blank (grey) windows of Java applications (such as netbeans)
Export this environment variable:

Start the program:

Background not redrawing
Sometimes the background may not properly redraw when the current view is switched. For example, some terminal emulators such as don't draw the entirety of their allocated window space. In these cases, X root window must have a properly defined color. This can be done with the command. For example: