From ArchWiki
Revision as of 22:17, 18 March 2012 by Moetunes (Talk | contribs) (can update the transparency value in the running wm)

Jump to: navigation, search

This template has only maintenance purposes. For linking to local translations please use interlanguage links, see Help:i18n#Interlanguage links.

Local languages: Català – Dansk – English – Español – Esperanto – Hrvatski – Indonesia – Italiano – Lietuviškai – Magyar – Nederlands – Norsk Bokmål – Polski – Português – Slovenský – Česky – Ελληνικά – Български – Русский – Српски – Українська – עברית – العربية – ไทย – 日本語 – 正體中文 – 简体中文 – 한국어

External languages (all articles in these languages should be moved to the external wiki): Deutsch – Français – Română – Suomi – Svenska – Tiếng Việt – Türkçe – فارسی

Snapwm is a very minimal and lightweight dynamic tiling window manager based on dminiwm (same author), which is based on catwm (by pyknite). It's basically dminiwm with a bar and reloadable rc file. It's primarily keyboard driven but has some mouse support also.

Layout Modes

It has four layout modes: vertical, horizontal, grid, and fullscreen. The default layout for all desktops is set in the config.h file and the rc file, and can be changed in the running wm.

It allows the "normal" method of tiling window managers, with the new window as the master, or with the new window opened at the top or bottom of the stack(attach aside). The default tiling method for all layout modes is set in the config.h and rc file, and can be changed in the running wm.


   |        | W |
   |        |___|
   | Master |   |
   |        |___|
   |        |   |
 Default keyboard shortcut : Alt+Shift+v


   |           |
   |  Master   |
   | W |   |   |
 Default keyboard shortcut : Alt+Shift+h


   |      | W  |
   |Master|    |
   |      |    |

With three or four windows open the master window and the window *W* can be resized. There are no useless gaps.

 Default keyboard shortcut : Alt+Shift+g


Takes up all the screen less the bar.

 Default keyboard shortcut : Alt+Shift+f
 There are no borders in fullscreen mode or if there is only one open window.
  • Changing the layout mode or resizing windows on one desktop doesn't affect the other desktops.
  • The Master window can be resized.
  • The window *W* at the top of the stack can be resized.
  • There is no floating mode other than for transient windows(popups).

The Bar

Snapwm has an integrated bar that has a clickable desktop switcher, shows the tiling mode, shows the focused window's name and space to display some external text.

The desktop switcher can optionally show the number of windows open on unfocused desktops and in fullscreen mode. Clicking on the current desktop in the switcher will focus the next window.

The bar uses the root window's name to display colored external text, which can be changed with xsetroot -name.

For example, with conky, you could use something like:

conky | while read -r; do xsetroot -name "$REPLY"; done &

You can toggle the bars' visibility.

 Default keyboard shortcut : Super+b

There's options in the config.h and rc file to have the bar shown at the top, the bottom or not at all. The bars' position is changeable in the running wm by editing the rc file.


The colors for the bar are defined in config.h and in .snapwmrc.

  • Color 1 : focused window border and desktop in switcher.
  • Color 2 : unfocused window border and desktop in switcher.
  • Color 3 : desktop in switcher with open windows.
  • Color 4 : the bar's border.
  • Color 5 : the focused window name font and also the first color for external text.
  • Color 6 : the desktop switcher font and also the second color for external text.
  • Colors 7, 8, and 9 : the third, fourth, and fifth colors for external text.

The colors for external text(Colors 5-9) can be displayed by placing & in front of the number of the color in your script. The numbers start at 0. So 0 would be the first color for external text(Color 5), 1 would be the second color(Color 6), etc. For example, using conky, you could do something like this for displaying the time using the second color for external text:

&1${time %I:%M}

The colors in the running wm are changeable by editing the rc file.


The bar does not support icons but you can draw "icons" into a font and use those. You can find more info on that in the dwm hacking thread on the forum. There are a few fonts in the AUR, such as terminusmod, tamsynmod, termsyn, and ohsnap that have some icons. Another example of using them with conky:

&2${execi 1800 printf '\xB6'} &1${time %I:%M}

This will display a clock "icon" from terminusmod font in the third color for external text and the time in the second color.


Configuration changes are done first by copying config.h.def to config.h, editing config.h and compiling. Most options are also in the rc file.

 The defined number of desktops must match the DESKTOPCHANGE keys

After you get a working config.h, you should compare that with the new config.h.def when updating and make any changes that are needed. You should familiarize yourself with the config.h. It's fairly self explanatory and well commented. You don't necessarily need any knowledge of C. You can look at other people's configs for examples and ideas, but don't just blindly copy and paste. At least try to understand what you're doing first. Remember to change the path for your .snapwmrc in config.h. At first, you'll need to at least learn a few of the basic keystrokes for opening a terminal, running dmenu, closing windows, quitting, etc. All of these can be found in the config.h.def. You can change them to suit, of course.

An example for setting Alt+x to open xterm. The terminal command would be

xterm -bg black -fg white

So make the command and the keyboard shortcut in the appropriate sections in the config.h.

 const char* xtermcmd[] = {"xterm","-bg","black","-fg","white",NULL};
 {  MOD1,             XK_x,     spawn,             {.com = xtermcmd}},

Window Manager Functions

The functions available to the user are :

   Default keyboard shortcut : Alt + j
   Default keyboard shortcut : Alt + k
   Default keyboard shortcut : Alt + Shift + j
   Default keyboard shortcut : Alt + Shift + k
   Default keyboard shortcut : Alt + Shift + Return
   Default keyboard shortcut : Alt + [number]
   Default keyboard shortcut : Alt + Tab
   Default keyboard shortcut : Super + Right/Left
   Default keyboard shortcut : Alt + Shift + [number]
   Default keyboard shortcut : Super + Shift + [number]
   Default keyboard shortcut : Alt + Shift + f/g/h/v
   Default keyboard shortcut : Alt + h/l
   Default keyboard shortcut : Alt + p/o
   Default keyboard shortcut : Alt + c
   Default keyboard shortcut : Control + Alt + q
   Default keyboard shortcut : User defined for each application
   Default keyboard shortcut : Super + b
   Default keyboard shortcut : Alt + u

rc file

snapwm comes with a rc file that can implement changes to most options on the fly, without the need for recompiling and which will take precedence over the compiled in options at startup. There is a sample.snapwmrc.file included that should be copied to .snapwmrc in $HOME and edited, with the correct path defined in config.h. To change something in the running window manager edit the rc file and save it, then hit the (default) Alt+u keys.


Unfocused windows have an alpha value and can be transparent if used with a compositing manager(like cairo-compmgr).

The value is a percent and can be changed in the running wm by editing the rc file, 100 is opaque.


The latest version can be downloaded using git. Initially, you can do:

git clone 

and then update with git pull. See the git wiki page or man git for more info.

Note: While the official name of the window manager and executable is snapwm, you'll notice that in moetunes github, the directory is named Nextwm which may cause some confusion.

Xlib is all that is required. To install it, do:

#make install
$make clean

Alternative Method

Instead of actually installing it system-wide as above, you can simply run make and then copy the executable to somewhere in your path, like ~/bin for example. You can then run it the same way(exec snapwm) on a per user basis.


Most users will want this. As the name implies, dmenu is a menu that acts like an autocomplete for typing the name of binaries. It integrates well with tiling window managers like snapwm. See the dmenu wiki page or man dmenu for more info. To install it, do:

pacman -S dmenu

The config.h.def comes with a command to start demenu_run, which will search $PATH for a matching executable as soon as you start typing.

 const char* dmenucmd[]      = {"dmenu_run","-i","-nb","#666622","-nf","white",NULL};

See also

  • The README and ChangeLog for additional info.