Skip to content

zmeadows/sunwm

Repository files navigation

sunwm

CI — Linux build & test Lint — Ormolu/HLint

A small, hackable tiling window manager for X11. Wayland is not supported currently.

Status: Actively being revived as of October 2025. This repository has been refreshed to use a modern Cabal (v2) workflow with reproducible builds and a clean developer experience. Expect rough edges while we modernize CI and packaging. Feedback and PRs welcome.


Table of contents


Requirements

  • A supported X11 environment (Xorg or Xwayland/Xephyr for testing).
  • GHC and cabal-install (GHCup recommended)
  • X11 development headers (listed below per distro).

Recommended toolchain (for development):

  • GHC 9.6.7 (or current GHCup recommended)
  • cabal-install 3.12+ (or GHCup recommended)
  • Optionally Haskell Language Server (HLS) for editor integration

The project uses a cabal.project with a pinned index-state for reproducible dependency resolution.


Installation

# 1) Install the Haskell toolchain (ghc, cabal)
#    recommended ultra-easy route: [GHCup](https://www.haskell.org/ghcup/)

# 2) Ensure you have the current recommended versions of ghc/cabal
ghcup install ghc recommended && ghcup set ghc recommended
ghcup install cabal recommended && ghcup set cabal recommended

# 3) Clone
git clone https://github.com/zmeadows/sunwm.git
cd sunwm

# 4) Install system packages (see section below for your distro)
# e.g., on Ubuntu:
sudo apt update && sudo apt install -y build-essential pkg-config \
    libx11-dev libxrandr-dev libxinerama-dev libxext-dev

# 5) Build
cabal update
cabal build all
cabal install exe:sunwm \
  --project-file=cabal.project.release \
  --installdir="$HOME/.local/bin" \ # <- choose install location in your path
  --overwrite-policy=always \
  --install-method=copy

System packages (X11 headers/libs)

Install your distribution’s C/C++ toolchain, pkg-config, and X11 client libraries/headers. Package names vary slightly by distro.

Debian/Ubuntu

sudo apt update
sudo apt install -y build-essential pkg-config \
  libx11-dev libxrandr-dev libxinerama-dev libxext-dev

Fedora/RHEL/CentOS

# Toolchain group
sudo dnf groupinstall -y "Development Tools"
# X11 headers
sudo dnf install -y libX11-devel libXrandr-devel libXinerama-devel libXext-devel

Arch/Manjaro

sudo pacman -Syu --needed base-devel pkgconf libx11 libxrandr libxinerama libxext

openSUSE

# Toolchain
sudo zypper install -y gcc make pkg-config
# X11 headers
sudo zypper install -y libX11-devel libXrandr-devel libXinerama-devel libXext-devel

Alpine

sudo apk add --no-cache build-base pkgconfig \
  libx11-dev libxrandr-dev libxinerama-dev libxext-dev

Nix/NixOS (dev shell)

# Ad-hoc shell with all deps
nix-shell -p ghc cabal-install pkg-config xorg.libX11 xorg.libXrandr xorg.libXinerama xorg.libXext

If you use another distro, search your package manager for the X11 equivalents of the above libs.


Build

# Update indices (pinned by cabal.project)
cabal update

# Build everything (library/executables/tests)
cabal build all

# Run tests (if any test suites are present)
cabal test

# Optional: record the exact dependency plan (commit the file if you want)
cabal freeze

If you hit linking issues, double-check that the X11 -dev/-devel packages are installed and visible to pkg-config.


Configuration

see Configuration documentation.


Run

Warning: Window managers take over your X session. Start in a nested X server first to keep your desktop safe.

Safest: run inside Xephyr

Install Xephyr (package name may be xserver-xephyr on Debian/Ubuntu). Then:

# Terminal 1: start nested X on display :1
Xephyr -br -ac -noreset -screen 1280x800 :1 &

# Terminal 2: run sunwm inside it
DISPLAY=:1 cabal run sunwm

If the executable name differs (e.g. multiple executables), adjust cabal run <exe-name> accordingly.

Using .xinitrc (TTY/Xorg)

Create/modify ~/.xinitrc to exec sunwm:

exec sunwm

Then from a TTY (e.g. Ctrl+Alt+F3):

startx

Desktop managers

If your display manager supports custom sessions, create a .desktop entry pointing to sunwm. Steps differ by DM; consult your DM’s docs.


Contributing

see Contributing documentation.

Recommendations

X11 window managers

Utilities


License

See LICENSE in this repository.