- C 87.2%
- Python 11.2%
- Makefile 1.4%
- Dockerfile 0.2%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| data | ||
| docs | ||
| protocols | ||
| src | ||
| tests | ||
| .dockerignore | ||
| .gitignore | ||
| CHANGELOG.md | ||
| compose.yaml | ||
| Dockerfile | ||
| LICENSE | ||
| Makefile | ||
| README.md | ||
stwm
stwm is a simple tiling window manager for Wayland. Windows arrange themselves, so there
is nothing to manage: open a few and they share the screen. It is written in C on wlroots,
works without a config file, and comes with its own bar and launcher. Nothing needs to be
memorized: Super+Slash shows every key, and Super+D finds every app and every action.
| Super+D searches apps and actions | Super+Slash shows every key |
|---|---|
![]() |
![]() |
Features
- Tiling that arranges itself: tile, wide, grid and monocle layouts per workspace, with a main area you can widen and fill with more windows. Dialogs float on their own.
- A launcher for everything (Super+D): type a few letters to start an app or run any action, with its key shown next to it, so the keys are learned along the way.
- Every key on one screen (Super+Slash), grouped and generated from the config in effect.
- A bar with workspaces you can click or scroll, the layout, the window title, the clock, and optionally the output of your own status script. On laptops it shows the battery as a filling icon with the percentage, the power draw and the time left, or the time to full while charging.
- Wi-Fi without a terminal: the bar shows the network in use with its signal strength. Click it, or search "Wi-Fi" with Super+D, to pick a network, type its password, disconnect or turn Wi-Fi off. This uses NetworkManager; without it the bar still shows whether you are on Wi-Fi, a cable or offline.
- A config that cannot lock you out: it reloads on save, a mistake shows up on screen with its line number and is skipped, and Ctrl+Alt+BackSpace always exits.
- A friendly first start: a welcome card with the keys that matter, and a config file written for you with every setting explained.
- Ready for a laptop: a login screen entry, a scale chosen from each monitor's pixel density, volume and brightness keys with an on-screen level, media keys, touchpad tapping and natural scrolling, and shortcuts that keep working on any keyboard layout.
- Works with the usual Wayland tools: panels and wallpapers (waybar, swaybg), notifications (mako), launchers (fuzzel), screen lockers (swaylock), idle managers (swayidle), screenshots (grim), screen sharing through xdg-desktop-portal-wlr, monitor tools (wlr-randr, kanshi) and night light (wlsunset, gammastep).
- Locking you can trust: if the screen locker crashes, the screen stays locked and says how to unlock it. Screens turn off after ten minutes without input unless a video is playing; locking when idle is one setting away.
- Everyday comforts: Alt+Tab between recent windows, a scratchpad for a window you summon and hide with one key, three-finger swipes between workspaces, and windows asking for attention marked in the bar instead of stealing focus.
- Nine workspaces across any number of monitors, focus and move by direction, focus follows
the mouse, Super+drag to move or swap windows, and
stwmctlfor scripts.
Status
Everything planned for the first release, 0.1.0, is built and tested; it has not been tagged yet. What has and has not been tried on real hardware is listed under What has been tested where.
Install
You need a C compiler, make, pkg-config and the development files for wlroots 0.18, 0.19
or 0.20, Wayland, xkbcommon, libinput, pixman and fcft, plus a font.
| System | Packages |
|---|---|
| Fedora 44 | wlroots-devel wayland-devel wayland-protocols-devel libxkbcommon-devel libinput-devel pixman-devel fcft-devel |
| Debian 13 | build-essential pkg-config libwlroots-0.18-dev libwayland-dev wayland-protocols libxkbcommon-dev libinput-dev libpixman-1-dev libfcft-dev libdrm-dev fonts-dejavu-core |
| Alpine 3.24 | build-base pkgconf linux-headers wlroots0.19-dev wayland-dev wayland-protocols libxkbcommon-dev libinput-dev pixman-dev fcft-dev libdrm-dev font-dejavu |
make
sudo make install
make uses the newest wlroots it finds; make WLROOTS=wlroots-0.18 picks one. make install
puts stwm and stwmctl in /usr/local/bin, adds stwm to the login screen's session list
and the example config to /usr/local/share/doc/stwm. It honours PREFIX and DESTDIR, and
sudo make uninstall removes it all again.
Running it
After sudo make install, log out and pick stwm in the session menu of the login screen
(SDDM, GDM and others read /usr/local/share/wayland-sessions). From a virtual terminal
(Ctrl+Alt+F3, log in), run stwm. To try it without logging out, run stwm from a terminal
in your current desktop and it opens in a window.
stwm writes its messages to standard error; the login screen decides where that goes. With
SDDM on Fedora 44 it is ~/.cache/wayland-errors; older SDDM versions use
~/.local/share/sddm/wayland-session.log.
If you also use KDE Plasma on the same account, browsers that keep their passwords in KWallet
under Plasma do not find them under stwm, because they choose the keyring by desktop name.
Chrome, for example, then signs you out of your accounts. Start it with
--password-store=kwallet6 to keep using KWallet.
On a fresh system without a desktop
On a plain command-line install of Debian or Alpine, stwm needs a little more than its build packages: something that gives it the screen and input devices (a seat manager), graphics drivers, a session bus, a font and a terminal. stwm does not run X11 programs; apps that only support X11 will not open.
Debian 13, as root. systemd-logind already manages the seat and the runtime folder, and brightness keys work through it.
# to build and run stwm
apt install build-essential pkg-config git libwlroots-0.18-dev libwayland-dev \
wayland-protocols libxkbcommon-dev libinput-dev libpixman-1-dev libfcft-dev libdrm-dev \
dbus-user-session fonts-dejavu-core foot
# sound, locking, screenshots, screen sharing, media keys
apt install pipewire pipewire-pulse wireplumber swaylock swayidle grim playerctl \
xdg-desktop-portal-wlr xdg-desktop-portal-gtk
# laptops: Wi-Fi, which the bar's Wi-Fi list controls
apt install network-manager
Alpine 3.24, as root. Alpine uses seatd for the seat and needs udev for input devices.
setup-devd udev
apk add build-base pkgconf linux-headers git wlroots0.19-dev wayland-dev wayland-protocols \
libxkbcommon-dev libinput-dev pixman-dev fcft-dev libdrm-dev \
seatd mesa-dri-gallium font-dejavu foot dbus
rc-update add seatd && rc-service seatd start
rc-update add dbus && rc-service dbus start
adduser YOUR_USER seat
# sound, locking, screenshots, screen sharing, media keys
apk add pipewire wireplumber pipewire-pulse swaylock swayidle grim playerctl \
xdg-desktop-portal-wlr xdg-desktop-portal-gtk
# laptops: brightness keys and Wi-Fi
apk add brightnessctl brightnessctl-udev networkmanager networkmanager-wifi
adduser YOUR_USER video
On Alpine, nothing creates the runtime folder or starts PipeWire for you. Add this to
~/.profile:
if [ -z "$XDG_RUNTIME_DIR" ]; then
XDG_RUNTIME_DIR=$(mktemp -d "/tmp/runtime-$(id -u).XXXXXX")
export XDG_RUNTIME_DIR
fi
and this to [startup] in ~/.config/stwm/config:
/usr/libexec/pipewire-launcher
Then, on both, as your user:
git clone https://git.turbotux.xyz/michanical/stwm.git
cd stwm && make && sudo make install # or: su -c 'make install'
Log in on the first virtual terminal and run stwm (on Alpine, dbus-run-session stwm). To
start it on every login there, add to the end of ~/.profile:
if [ -z "$WAYLAND_DISPLAY" ] && [ "$(tty)" = /dev/tty1 ]; then
exec stwm # on Alpine: exec dbus-run-session stwm
fi
On a laptop, Debian suspends when the lid closes; Alpine does not unless you set that up, for
example with acpid. To lock the screen before sleep, run swayidle from [startup]:
swayidle -w before-sleep 'swaylock -f'
The package lists above were checked by building and installing stwm on fresh Debian 13 and Alpine 3.24 images and running a terminal in it. The parts a container cannot show, such as seatd, udev, the graphics drivers on real hardware, sound and suspend, have not been tried.
Optional companions
stwm works on its own. These add to it, and are found automatically when installed:
| For | Install | Notes |
|---|---|---|
| Locking the screen (Super+Escape) | swaylock |
or set lock-command |
| Screen sharing in browsers and video calls | xdg-desktop-portal-wlr |
make install adds the portal config |
| Brightness keys | nothing, or brightnessctl |
logind is used when brightnessctl is missing |
| Media keys | playerctl |
any MPRIS player works without it |
| Panels, notifications, wallpaper | waybar, mako, swaybg |
start them from [startup] |
The first time, stwm greets you with the keys that matter and writes
~/.config/stwm/config with every setting explained. Super+Return opens a terminal, Super+D
starts anything, and Ctrl+Alt+BackSpace always exits, even with a broken config.
Keys
| Keys | Action |
|---|---|
| Super+Return | Open a terminal |
| Super+D | Search apps and actions |
| Super+Slash | Show all keys |
| Super+Q | Close the window |
| Super+H J K L, Super+arrows | Focus the window to the left, below, above, right |
| Super+Shift+H J K L, Super+Shift+arrows | Move the window that way |
| Super+Shift+Return | Make the window the main one |
| Super+1 to 9 | Go to a workspace |
| Super+Shift+1 to 9 | Move the window to a workspace |
| Super+Tab | Go back to the last workspace |
| Alt+Tab, Alt+Shift+Tab | Switch windows, most recent first; release Alt to choose |
| Super+Grave | Show or hide the scratchpad |
| Super+Shift+Grave | Move the window to the scratchpad |
| Super+U | Go to the window asking for attention |
| Super+Space | Next layout |
| Super+T, W, G, M | Tile, wide, grid or monocle layout |
| Super+Ctrl+H, Super+Ctrl+L | Make the main area smaller or larger |
| Super+Equal, Super+Minus | More or fewer windows in the main area |
| Super+Shift+Space | Float or tile the window |
| Super+F | Fullscreen |
| Super+O, Super+Shift+O | Focus the next monitor, move the window there |
| Super+Escape | Lock the screen |
| Super+Shift+R | Reload the config |
| Super+Shift+E | Exit, after asking |
| Volume, brightness and media keys | Change the level, shown briefly on screen |
| Super+drag | Move a window; dropping a tiled window on another swaps them |
| Super+right-drag | Resize a floating window, or the main area |
| Three-finger swipe | Next or previous workspace |
stwmctl get keys lists every binding in effect, with a description, and man stwm
describes every key, setting and command.
Configuration
stwm reads ~/.config/stwm/config and reloads it whenever you save it. On the first start
it writes that file from docs/config.example, which lists every
setting with its default:
[general]
gaps = 8
layout = tile
[keys]
super+b = exec firefox
super+q = none
[rules]
pavucontrol = float
[output eDP-1]
scale = 1.5
A line stwm does not understand is skipped and shown on screen with its line number, and the
previous value stays in effect. stwm --check-config lists the problems in a file without
starting anything; in a running session, stwmctl get errors does.
stwmctl
stwmctl runs any command from the [keys] section in the running session, and prints the
current state as JSON:
stwmctl workspace 3
stwmctl layout grid
stwmctl exec firefox
stwmctl get windows # also workspaces, outputs, keys, errors, ui
stwmctl create-output # an extra virtual monitor, when running nested
stwmctl exit exits at once; Super+Shift+E asks first.
Development
make test # unit tests, then end-to-end tests on the headless backend
make lint # gcc and clang with warnings as errors
make sanitize # every test under AddressSanitizer and UBSan
docker compose build && docker compose run --rm test-debian # or test-alpine
The end-to-end tests need python3; the key binding tests also need wtype and are skipped
without it. Each test starts stwm on the wlroots headless backend with the software
renderer, opens windows with a small test client (tests/client.c) and checks the result
through stwmctl, so no display or GPU is needed.
The code is split in two. src/core is plain C with no wlroots in it (layouts, commands, key
and config parsing, app search) and is unit tested directly. src/wm is the compositor
around it, including the bar and overlays drawn with fcft, and src/ctl is stwmctl.
What has been tested where
| wlroots | Tested | |
|---|---|---|
| Fedora 44 | 0.20 | All tests; screenshots at 1280x720 and 2880x1800 at scale 1.5; nested inside Plasma on an Intel GPU |
| Debian 13 | 0.18 | All tests, in Docker |
| Alpine 3.24 (musl) | 0.19 | All tests, in Docker |
Not tested yet: running as the main session on real hardware (from a virtual terminal or a
login screen), real keyboards, touchpads and mice, more than one physical monitor, the
active keyboard layout in the bar. Monitor hotplug is tested with virtual monitors; volume
and media keys with stand-in wpctl and playerctl programs; brightness only by checking
that logind accepts the request. Panels, locking, idle inhibition, output management and
the mouse are tested with the test client and wlr-randr; waybar, swaylock, swayidle, night
light tools, pointer locking in games and screen sharing through the portal have not been
tried. Touchpad gestures have no automated test, because virtual pointers cannot swipe. Mouse actions
(focus follows mouse, Super+drag to move, swap or resize) have no automated test yet;
keyboard input is tested through a virtual keyboard.
License
MIT, see LICENSE.


