Dwm

DWM is a dynamic window manager for X. It manages windows in tiled and floating layouts. Either layout can be applied dynamically, optimizing the environment for the application in use and the task performed.

About DWM
"In contrast to ion, larswm, and wmii, dwm is much smaller, faster and simpler with < 2000 SLOC (Source Lines of Code)." -- DWM's Home Page.

This window manager gives you only what you need for a desktop with the features to navigate it, and nothing more!


 * I spend most of my time in a shell (URxvt with GNU Screen), so I rarely ever see my desktop along with all the other bloated window manager's features.


 * If I need a file manager, I'll use Thunar with its Volume Management feature for automatically mounting removable media. Or, for a more lightweight alternative, pcmanfm.


 * I've realized over the years, once I have modified or edited my settings, they usually remain the same for years.

Because of all this, DWM's static settings along with no desktop icons & menus omits a lot of resource hungry code!

Installation
There are two methods of installing DWM. The regular method is using Gentoo's Portage. The second method is by manually getting the source code. The benefit for the second method is you're getting your hands on the most up-to-date code prior to it's entry into the Portage packaging system.

Regular Install using Portage Emerge
Being such a small program DWM does not come with a lot of USE flags either. Due to the nature of DWM, it's recommended to enable the "savedconfig" USE Flag.


 * Allows for dual monitors.
 * Restores your config from /etc/portage/savedconfig $/$.

For installing DWM via Portage, you can simply run:

Install from Source Code
You can get the source code two different ways:


 * Directly from the main mirror.


 * Via mercurial.

You can manage updates for DWM using Mercurial:

Check if you have permission to write in /usr/local and compile the source:

To customize dwm, just rewrite config.mk and config.h.

Optional DMenu Package
DWM also has a simple program launching utility called DMenu (and is also used by some other window managers). Like DWM itself, DMemu honors the "savedconfig", placing its config file in /etc/portage/savedconfig/x11-misc/.

The Configuration File (dwm.h)
DWM does not have any configuration files. Instead all configuration of DWM must be done through source code. This means, in order to change the window manager, one must first understand C and then recompile the package from source. This may pose as a problem to many users.

Fortunately, Gentoo provides an easy way to accomplish this. The DWM C header file, which serves as the user configuration file, is saved to /etc/portage/savedconfig/x11-wm/. This feature is activated with the USE Flag "savedconfig". After editing this config file, the next time you emerge DWM, this file will be used in place of the default header file (thereby incorporating your customizations). The USE flag also prevents the emerge process from overwriting your saved configuration, which will be used each time you emerge DWM. While this may seem tedious, DWM is so tiny (<= 2000 lines of code), it only takes seconds to emerge.

The file is laid out such that non-programmers can manage to make common customizations without any problems (colors, key bindings, etc.). With a little C programming skill one can make more substantial customizations. The source code of the application itself is readable and lends itself to patching. Patches created by other users are available on the application's home page and other places on the web.

To edit the DWM configuration file, if you have enabled the savedconfig USE Flag:

If you want auto syntax hilighting, it has been recommended to create a symlink to this file:

Settings File (dwm.rc)
The default xsession file provided by the Gentoo Ebuild (/etc/X11/Sessions/dwm) provides for a default status box that displays system load and the date/time or whatever shell code the user creates at ~/.dwm/dwmrc. (chmod a+x dwmrc required). The present mechanism (as of dwm-5.4, dwm-5.6) 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, your CPU temperature, the current track on your music player, number of unread emails, etc.)

Usage
The easy way to run dwm is modify your ~/.xinitrc, for example like this:

and run it with startx.

I (not the original author of this Wiki) have tried using Display Managers, but I stopped using them after realizing they were more bloated than this Window Manager. I even tried Slim. You can spend time configuring your favored Display Manager, but some users of DWM may prefer to start from tty console. The Tips Section below gives some additional ideas.

Moving & Resizing Windows
You can move and resize windows, pressing the ALT (aka META) key + left (or right) mouse buttons.

Viewing Virtual Desktops
To view the other desktops, either use a mouse click on the number of the desktop or use ALT (aka META) key + (number). You can toggle between the current desktop & previous using ALT (aka META) + TAB keys.

Most key sequences are easily found within the DWM manfile.

Using DMenu
DMenu is pretty simple to use. ALT (aka META) + p key sequence enables the menu. The default location is at the top of the screen and can be configured to use the bottom of the screen. Simply type the name of the program. It basically emulates command line shell syntax using "tab completion". Press ESC to escape the menu.

Simple .dwmrc
The .dwmrc file is treated like a regular sh script file.

Custom Status Bar 1
If you don't like the current status bar of dwm, it is possible to customize it. For example, this is my personal ~/.xinitrc:

and run it with startx.

Status Bar with Date/Time and DWM Restart Feature
This is a more simple & basic status bar only displaying the date, including time (without seconds) updated every 55 seconds. This will also auto start a simple terminal. A neat feature of this script, if you update the DWM package, you can simply restart it with the META + SHIFT + q key sequence and it will reload without closing all of your other applications!

(I have commented out my custom urxvt+screen.sh script to display some of the other possibilities.)

Status Bar with Conky
If you are familiar with / or prefer Conky to manage your status bar, you can create a config for Conky which prints output to console.

Get conky:

Config example:

Now, simply add Conky to your .xinitrc:

This will make Conky start on startx command with DWM and replaces the status bar with the defined Conky output.

Automatically Start DWM on Login
If you prefer to start X on login, you can add the "startx" command to the bottom of your .bash_profile file. Users who log into this box using Telnet or OpenSSH, should be prevent from within the .bash_profile from executing these specific commands.

Configure the xorg.conf file
Here's a minimal xorg.conf using Nouveau driver for one NVidia card (one head) with two outputs, a DVI and VGA (aka DVI-I-1, VGA-1). (You need to fill in your "Input Devices Section", "Fonts Section", and YOUR Monitor values!)

Modify your dwm.h file
Within your dwm.h file, the sixth (last) field (containing a default -1) specifies the monitor. A value of "0" sends an instance of mplayer to my second (VGA-1) monitor. (Seems dwm.h takes precedence over mplayer's -xineramascreen option, as well as the -geometery option? So specifying monitor and full screen using dwm.h is best?)

Compile DWM and DMenu
Compile DWM and DMenu with USE=xinerama, but do not add or enable the Xinerama extension in xorg.conf -- or it's enabled by default. (I ran into a problem with Xinerama disabling xrandr.)

References for configuring Xinerama

 * nouveau Wiki Randr12
 * Gentoo Wiki's Dual Monitors
 * XStrikeForce HowToRandR12