Dwm

dwm is a dynamic window manager for X. It manages windows in tiled, monocle and floating layouts. All of the layouts can be applied dynamically, optimising the environment for the application in use and the task performed.


 * dwm is only a single binary, and its source code is intended to never exceed 2000 SLOC.
 * dwm is customized through editing its source code

USE flags
Preferably, you'll want to enable  USE flag and save your customized configuration file to  for later editing pleasure.

If you have multiple monitors, you should also enable the  USE flag regardless of whether or not you're using Xinerama.

Emerge
Install :

Starting
To start dwm you can use a display manager or startx.

If want to use startx and want ConsoleKit support, setup ConsoleKit and 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 your editor to use syntax highlighting feature for C code, create a symlink using a header filename.

(If you're 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, your CPU temperature, the current track on your music player, number of unread emails, etc.)

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

(aka META) + key sequence enables the menu.

You can customize dmenu's options during execution using the file, such as displaying the menu at the bottom of the display.

Conky
For displaying additional status information on dwm's menu bar, one can use Conky. 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.

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 you want to move the window to.

Commonly used keys

 * + - Display window tag number two
 * + - dmenu
 * ++ - Kills a window


 * ++ - Launch a terminal
 * + - Use a tile layout
 * ++ - Quit dwm


 * ++ - 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.

Volume keys
Add following lines to your 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 *pulseup[] = { "amixer", "-q", "sset", "Master", "1%+", NULL }; static const char *pulsedown[] = { "amixer", "-q", "sset", "Master", "1%-", NULL }; ...

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

Customization
(Put user customization tricks & tips here.)

Patching
For purpose of patching dwm, here is gentoo way of doing that. If you have patches ready to be merged with dwm source, there is special function epatch_user which helps us to do so. You can move your patches in


 * patches in /etc/portage/patches/category/application or
 * patches in your Custom repository

Patches in /etc/portage/patches/category/application
Firstly we need to create directory /etc/portage/patches/x11-wm/dwm if they don't exist.

Copy your dwm patches to /etc/portage/pacthes/x11-wm/dwm/ and make sure you prefixed your 01-name_of_patch.patch with number, like so. Also the file needs to be named *.patch othewise portage doesn't apply it. For this example we will assume that patch is located in you $HOME.

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

Patches in a Custom repository
Copy x11-wm/dwm from /usr/portage/ to our Custom repository, for more information how to create Custom repository read Custom repository. Next we need to place our patches in files directory. Make sure patches are prefixed with number.

Open /usr/local/portage/x11-wm/dwm/dwm-6.0.ebuild or whatever location of Custom repository you have and at the end of src_prepare function insert for loop which will parse all *.diff files in files directory and patch dwm source.

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, you need to know the "name" of the application recorded by Xorg so dwm can be aware of this window on startup. To find this, start your 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 your 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 your custom file and then find the default dwm-6.0  file and diff against your old  file. (Or, uncompress the dwm-6.0 tarball to acquire the default dwm-6.0 file.)

Remap META Key
If you have conflicts with the default dwm ALT key conflicting with your other console interface applications, you can use the ESC key while within your 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, you can 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. You'll need the package 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

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:

and start the program: