From ArchWiki
Revision as of 22:23, 15 August 2012 by Moetunes (talk | contribs)
Jump to: navigation, search

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 user settings in reloadable conf files. It's primarily keyboard driven but has some mouse support also.

Layout Modes

It has five layout modes: vertical, horizontal, grid, fullscreen and center stacking. The default layout for all desktops is set in rc.conf, 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 rc.conf, 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|    |
   |      |    |
 Default keyboard shortcut : Alt+Shift+g

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

Center Stacking

   |   ______  |
   |  | ____ | |
   |  ||____|| |
   |  |______| |
 Default keyboard shortcut : Alt+Shift+c
 Windows can be moved up/down
   Default keyboard shortcut : Alt+Shift+j/k
 Windows can be moved right/left
   Default keyboard shortcut : Alt+Shift+p/o
 Windows can be made wider/narrower
   Default keyboard shortcut : Alt+h/l
 Windows can be made taller/shorter
   Default keyboard shortcut : Alt+p/o


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.
  • Windows can be added/removed to/from the master area with keyboard shortcuts Alt+Shift+m/l
  • The window *W* at the top of the stack can be resized.
  • In stacking mode the windows can be resized/moved with Alt+right/left mouse button and
  • the size and position is remembered when the mode is changed

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 rc file to have the bar shown at the top, the bottom. The bars' position is changeable in the running wm by editing the rc file.


The colors for the bar are defined in BARTHEME in rc.conf.

  • Color 0 : focused desktop in switcher.
  • Color 1 : unfocused desktop in switcher.
  • Color 2 : unfocused desktop in switcher with open windows.
  • Color 3 : the bar's border.

The colors for the text in the bar are defined in TEXTTHEME in rc.conf.

  • Color 0 : the current desktop font in the switcher and also the first color for external text.
  • Color 1 : the unfocused desktops font in the switcher and also the second color for external text.
  • Color 2 : the unfocused desktops with opened windows font in the switcher and also the third color for external text.
  • Color 3 : the focused window name font and also the fourth color for external text.
  • Colors 4, 5, and 6 : the fourth, fifth and sixth colors for external text.

The colors for the windows are defined in WINDOWTHEME in rc.conf.

  • Color 0 : focused window border.
  • Color 1 : unfocused window border.

The colors for external text can be displayed by placing & in front of the number of the color in your script. The numbers start at 0. 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. To have them shown in the bar print them in a terminal then copy/paste them in rc.conf or your script/conky. You can also use a font like stlarch_font that just contains icons. You can use it in combination with another font using a comma to seperate them in your rc.conf:

static const char defaultfontlist[] = "-*-stlarch-medium-r-*-*-10-*-*-*-*-*-*-*,-*-terminus-medium-r-*-*-12-*-*-*-*-*-*-*";


All user settings are read from three files in ~/.config/snapwm/ . Each line in these files takes the form of :

 <Option><space><semi colon seperated list>

and if there is more than one item in the list the line must end in a semi colon.

snapwm comes with sample configurations files which make it easy to start configuration.

All options and settings in the three configuration files are changeable in the running window manager by editing and saving the configuration file/s and updating. (default key Alt+u)


<option><space><semi colon seperated list>

Should have the number of desktops as the first option, which is changeable in the running window manager.

Colours, how new windows are handled and options for the bar are set here.


There are two options CMD and KEY . CMD should come before any key using it.

CMD takes the form of :

 CMD<space><label>;<comand>;<command option1>;<command option2>...;NULL;

The label is passed to a KEY later and the line must end in NULL;

KEY takes the form of :


There are six modifying keys available :

   Alt  CtrlAlt  ShftAlt  Super  ShftSuper  CtrlSuper

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

xterm -bg black -fg white

To make the command and the keyboard shortcut.

 CMD xtermcmd;xterm;-bg;black;-fg;white;NULL;
 KEY Alt;x;spawn;xtermcmd;


There are two options DESKTOP and POSITION . Order isn't important.

DESKTOP is used to set the desktop that an app will open on and whether to change to that desktop when the app opens.

POSITION is used to set the geometry of an app in stacking mode.

DESKTOP takes the form of :

 DESKTOP<space><window class><desktop to open on><zero to change to that desktop>;

<window class> is found by using xprop on the app and reading the WM_CLASS value.

POSITION takes the form of :

 POSITION<space><window class><x><y><width><height>

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 + c/f/g/h/v
   Default keyboard shortcut : Alt + a
   Default keyboard shortcut : Alt + h/l
   Default keyboard shortcut : Alt + Shift + m/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


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.


Using the AUR

Download snapwm-gitAUR from the AUR. Then, as a non-root user, run:

$ makepkg -i

while in the saved PKGBUILD's directory. The files will be retrieved, built and installed.

The sample configuration files will be installed in /usr/share/snapwm-git/. Create the directory ~/.config/snapwm/:

$ mkdir -p ~/.config/snapwm/

Copy the three sample files to ~/.config/snapwm/rc.conf and edit to suit.

Using Git

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 will 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 auto-complete 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 sample.rc.conf file 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.