Skip to content
Julian Cohn edited this page Feb 27, 2016 · 27 revisions

Table of Contents

Introduction

spectrwm is a small dynamic tiling window manager for X11. It tries to stay out of the way so that valuable screen real estate can be used for much more important stuff. It has sane defaults and does not require one to learn a language to do any configuration. It is written by hackers for hackers and it strives to be small, compact and fast.

It was largely inspired by xmonad and dwm. Both are fine products but suffer from things like: crazy-unportable-language-syndrome, silly defaults, asymmetrical window layout, "how hard can it be?" and good old NIH. Nevertheless dwm was a phenomenal resource and many good ideas and code was borrowed from it. On the other hand xmonad has great defaults, key bindings and xinerama support but is crippled by not being written in C.

spectrwm is a beautiful pearl! For it too, was created by grinding irritation. Nothing is a bigger waste of time than moving windows around until they are the right size-ish or having just about any relevant key combination being eaten for some task one never needs. The path of agony is too long to quote and in classical OpenBSD fashion (put up, or hack up) a brand new window manager was whooped up to serve no other purpose than to obey its masters. It is released under the ISC license (see below). Patches can be accepted provided they are ISC licensed as well.

Following are a few screenshots of spectrwm in action.

Vertical stack Horizontal stack Horizontal stack Vertical stack with floater and extra window in master area mplayer, resized and moved

Major features

  • Dynamic RandR support (multi-head)
  • Navigation anywhere on all screens with either the keyboard or mouse
  • Customizable status bar
  • Human readable configuration file
  • Restartable without losing state
  • Quick launch menu
  • Many screen layouts possible with a few simple key strokes
  • Windows can be added or removed from master area
  • Windows can be moved to any workspace or within a region
  • Resizable master area
  • Move/resize floating windows
  • Drag-to-float
  • Extended Window Manager Hints (EWMH) Support
  • Configureable tiling
  • Adjustable tile gap allows for a true one pixel border.
  • Customizable colors and border width.
  • User definable regions
  • User definable modkey & key bindings
  • User definable quirk bindings
  • User definable key bindings to launch applications
  • Multi OS support (*BSD, Linux, OSX, Windows/cygwin)

To-do

  • add identify window function
  • make a floating stack mechanism
Please read the man pages for a more detailed explanation.

OSX

OSX Screenshot

A port to OSX was created to make OSX useful for UNIX people. Following are the compilation and installation steps.

Compile spectrwm from the osx directory of the snapshot:

cd osx
make

If you are using homebrew instead of macports, uncomment the lines:

INCFLAGS+= -I/opt/X11/include
LDADD+=  -lX11 -lXcursor -lXft -L/opt/X11/lib
INCFLAGS+= -I/usr/local/Cellar/freetype/2.4.10/include/freetype2
and comment out the lines:
INCFLAGS+= -I/opt/local/include/freetype2 -I/opt/local/include
LDADD+=  -L/opt/local/lib -lX11 -lXcursor -lXft

To compile spectrwm on OSX 10.5 edit the Makefile and replace:

libswmhack.so.$(LVERS): swm_hack.so
	$(CC) -shared -fpic -o libswmhack.so.$(LVERS) $(LDADD) swm_hack.so
With:
libswmhack.so.$(LVERS): swm_hack.so
	$(CC) -shared -bundle -fpic -o libswmhack.so.$(LVERS) $(LDADD) swm_hack.so
Install spectrwm:
sudo make install
Download dmenu and compile it:
make
Install dmenu:
sudo make install
Create a .xinitrc in the home dir of the user and add at least the following line:
exec spectrwm
Set the X11 preferences of OSX to the following:

Windows/Cygwin

Cygwin Screenshot

A port to Windows/cygwin was created to make Windows useful for UNIX people. Following are the compilation and installation steps.

Compile spectrwm from the linux directory of the snapshot:

cd linux
make
Install spectrwm:
sudo make install
Download dmenu and patch config.mk with:
$ diff -uNp config.mk.old config.mk
--- config.mk.old       2010-01-11 16:23:55.503440600 -0600
+++ config.mk   2010-01-11 16:24:04.300315600 -0600
@@ -20,7 +20,7 @@ LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 

# flags
CPPFLAGS = -D_BSD_SOURCE -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
-CFLAGS = -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS}
+CFLAGS = -Wall -Os ${INCS} ${CPPFLAGS}
LDFLAGS = -s ${LIBS}

# Solaris

Compile it:

make
Install dmenu:
sudo make install
To get Windows ALT key sequences (such as ALT+TAB) picked up by spectrwm, and let you use CTRL+ALT+Backspace to exit the X server, create a .xserverrc in the home dir of the user with the following line:
exec XWin :0 -nodecoration -unixkill -keyhook
Create a .xinitrc in the home dir of the user and add at least the following line:
exec /usr/local/bin/spectrwm
If the stupid menu bar in xterm angers you add the folowing line to ~/.Xdefaults
xterm.ToolBar:          false
This all results in spectrwm bliss!

spectrwm Resources

  • Mailing lists
    • spectrwm (discussion)
      • subscribe: email spectrwm+subscribe at opensource.conformal.com
      • unsubscribe: email spectrwm+unsubscribe at opensource.conformal.com
    • spectrwm-commits
      • subscribe: email spectrwm-commits+subscribe at opensource.conformal.com
      • unsubscribe: email spectrwm-commits+unsubscribe at opensource.conformal.com

License

spectrwm is ISC licensed software; we prefer code that comes with a simple license like the OpenBSD license.template, and all the spectrwm-specific code is licensed accordingly, as follows:

/*
 * Copyright (c) 2009-2012 Marco Peereboom <[email protected]>
 * Copyright (c) 2009-2011 Ryan McBride <[email protected]>
 * Copyright (c) 2009 Darrin Chandler <[email protected]>
 * Copyright (c) 2009 Pierre-Yves Ritschard <[email protected]>
 * Copyright (c) 2010 Tuukka Kataja <[email protected]>
 * Copyright (c) 2011 Jason L. Wright <[email protected]>
 * Copyright (c) 2011-2014 Reginald Kennedy <[email protected]>
 * Copyright (c) 2011-2012 Lawrence Teo <[email protected]>
 * Copyright (c) 2011-2012 Tiago Cunha <[email protected]>
 * Copyright (c) 2012-2013 David Hill <[email protected]>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */
Additionally, much code in spectrwm.c comes from dwm under the following license:
/*
 * Much code and ideas taken from dwm under the following license:
 * MIT/X Consortium License
 * 
 * 2006-2008 Anselm R Garbe <garbeam at gmail dot com>
 * 2006-2007 Sander van Dijk <a dot h dot vandijk at gmail dot com>
 * 2006-2007 Jukka Salmi <jukka at salmi dot ch>
 * 2007 Premysl Hruby <dfenze at gmail dot com>
 * 2007 Szabolcs Nagy <nszabolcs at gmail dot com>
 * 2007 Christof Musik <christof at sendfax dot de>
 * 2007-2008 Enno Gottox Boland <gottox at s01 dot de>
 * 2007-2008 Peter Hartlich <sgkkr at hartlich dot com>
 * 2008 Martin Hurton <martin dot hurton at gmail dot com>
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 * DEALINGS IN THE SOFTWARE.
 */
Finally, The LD_PRELOAD hack in lib/swm_hack.c is licensed as follows:
/*                                                                               
 * Copyright (c) 2009 Marco Peereboom <[email protected]>                       
 * Copyright (c) 2009 Ryan McBride <[email protected]>                    
 *                                                                               
 * Permission to use, copy, modify, and distribute this software for any         
 * purpose with or without fee is hereby granted, provided that the above        
 * copyright notice and this permission notice appear in all copies.             
 *                                                                               
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES      
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF              
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR       
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES        
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN         
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF       
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.                
 */
It is based on code from e16, licensed on follows:
/*
 * Copyright (C) 2005-2007 Carsten Haitzler
 * Copyright (C) 2006-2007 Kim Woelders
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to
 * deal in the Software without restriction, including without limitation the
 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 * sell copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies of the Software, its documentation and marketing & publicity
 * materials, and acknowledgment shall be given in the documentation, materials
 * and software packages that this Software was used.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
Clone this wiki locally