Introduction
xmonad is a dynamically tiling window manager for X11, written and configured entirely in Haskell. It automatically arranges windows in non-overlapping tiles, uses the Haskell type system to catch configuration errors at compile time, and provides a rich library of community-contributed extensions called xmonad-contrib.
What xmonad Does
- Tiles windows automatically using pluggable layout algorithms
- Manages workspaces with one-key switching and window movement
- Compiles the user config as a Haskell program, catching errors before they run
- Supports multi-monitor setups with independent workspace-per-screen
- Extends behavior through 200+ modules in xmonad-contrib
Architecture Overview
xmonad is a Haskell library that the user's config file (xmonad.hs) imports and extends. On recompile, GHC builds a new binary from the config; xmonad then replaces itself with the new version via exec, preserving window state. The core is under 1,200 lines of Haskell and delegates policy (layouts, key bindings, hooks) entirely to user code and contrib modules.
Self-Hosting & Configuration
- Config lives at
~/.xmonad/xmonad.hs(or~/.config/xmonad/xmonad.hs) - Requires GHC (Glasgow Haskell Compiler) to compile the configuration
- Add layouts, hooks, and keybindings by importing from XMonad.Layout, XMonad.Hooks, etc.
- Use xmobar or Polybar as a status bar; pipe workspace info via log hooks
- Test config changes with
xmonad --recompilebefore applying
Key Features
- Type-safe config: the Haskell compiler catches config errors before they affect the running WM
- Hot-restart: recompile and restart without losing window state
- Minimal core: the entire WM is under 1,200 lines, making it auditable
- xmonad-contrib: 200+ modules for layouts, prompts, scratchpads, and decorations
- Stable: correctness properties are well-tested; crashes are rare
Comparison with Similar Tools
- Awesome WM — Lua-configured tiling WM; more beginner-friendly, heavier
- i3 — manual tiling with a simple text config; no programming language
- dwm — suckless C tiling WM; config via C source patching
- bspwm — binary-space tiling WM; configured via shell commands
- Qtile — Python-based tiling WM; similar concept, different language
FAQ
Q: Do I need to know Haskell to use xmonad? A: Basic pattern matching and function composition are enough. Most configs copy and adapt examples from the docs.
Q: Does xmonad work on Wayland? A: No. xmonad is X11-only. Wayland alternatives include Sway and Hyprland.
Q: How do I add a status bar? A: Use xmobar (Haskell-based) or Polybar. Configure a logHook in xmonad.hs to pipe workspace and layout information to the bar.
Q: Can I use floating windows in xmonad? A: Yes. xmonad supports a floating layer. You can float individual windows with a keybinding or set float rules for specific applications via manageHook.