README 6.2 KiB raw
1
2
3
4
     ███████╗██╗    ██╗███╗   ███╗
5
     ██╔════╝██║    ██║████╗ ████║
6
     ███████╗██║ █╗ ██║██╔████╔██║
7
     ╚════██║██║███╗██║██║╚██╔╝██║
8
     ███████║╚███╔███╔╝██║ ╚═╝ ██║
9
     ╚══════╝ ╚══╝╚══╝ ╚═╝     ╚═╝
10
          simple window manager
11
12
13
swm is a dynamic tiling Wayland compositor based on wlroots. It began as a
14
fork of dwl[0], replacing dwl's dwm-style window-management policy with one
15
inspired by spectrwm[1].
16
17
swm is configured in C and aims to remain small enough to understand, modify,
18
and extend. It supports native Wayland clients, X11 clients through Xwayland,
19
multiple outputs, global workspaces, server-side decorations, layer-shell
20
panels and launchers, session locking, idle inhibition, input methods, and
21
the standard wlroots output-management, screencopy, data-control,
22
foreign-toplevel, and toplevel image-capture protocols.
23
24
25
# REQUIREMENTS
26
27
Building swm requires:
28
29
* C compiler that supports C23, and lld
30
* GNU or BSD make
31
* pkg-config
32
* asciidoctor (man page)
33
* wlroots 0.20
34
* wayland and wayland-protocols
35
* libinput and xkbcommon
36
* libxcb and xcb-icccm
37
38
Xwayland is optional at runtime. Without it, swm continues to run but cannot
39
manage X11 applications. The default configuration uses these runtime commands:
40
41
* `foot` for the terminal, also started when swm starts
42
* `fuzzel` for the application launcher
43
* `swaylock` for screen locking
44
* `wpctl` for audio volume and mute controls
45
* `brightnessctl` for display and keyboard backlight controls
46
* `playerctl` for media playback controls
47
48
Install the commands for the features you use, or change them in `config.h`
49
and rebuild swm. The corresponding bindings require these commands to work.
50
51
52
# BUILD AND CONFIGURATION
53
54
    make
55
56
On the first build, `config.def.h` is copied to `config.h`. Subsequent builds,
57
including forced builds, preserve `config.h`. Edit that file to configure
58
appearance, input, monitor rules, application rules, layouts, commands,
59
autostart programs, and bindings, then rebuild swm.
60
61
There is no runtime configuration file. To return to the distributed defaults,
62
remove `config.h` and rebuild; save any local configuration first.
63
64
The compiler, installation prefix, version, and wlroots include/library flags
65
can be overridden in `config.mk` or on the make command line. In particular,
66
`WLR_INCS` and `WLR_LIBS` can point at a separately built wlroots tree.
67
68
69
# INSTALL
70
71
The default prefix is `/usr/local`:
72
73
    sudo make install
74
75
This installs the executable, `swm(1)` manual page, and Wayland session entry.
76
Use `PREFIX` and `DESTDIR` to change or stage the installation, for example:
77
78
    make PREFIX=/usr DESTDIR="$pkgdir" install
79
80
To remove the same installed files:
81
82
    sudo make uninstall
83
84
85
# RUN
86
87
Start `swm` from a TTY, select it in a display manager, or run it nested inside
88
another Wayland session. `XDG_RUNTIME_DIR` must be set.
89
90
    swm [--socket name] [-s command]
91
92
The `--socket` option selects the Wayland display socket name. swm creates the
93
socket after the display backend starts. Without this option, swm selects an
94
available socket name. The `-s` flag starts a command through `/bin/sh`; when
95
swm exits it terminates that command's process group. Programs listed in the
96
`autostart` array in `config.h` are started independently. Set
97
`SWM_NO_AUTOSTART=1` to suppress that array, which is useful for testing or a
98
minimal session.
99
100
swm sets `WAYLAND_DISPLAY`, `DISPLAY` when Xwayland is available, and
101
`XDG_CURRENT_DESKTOP=swm` for programs it starts.
102
103
104
# USAGE
105
106
The defaults use Super as Mod and provide ten global workspaces. A workspace can
107
appear on only one output; selecting one already visible elsewhere swaps the
108
two outputs' workspaces. Each workspace keeps its own layout state. Available
109
layouts place the master area on the left, top, right, or bottom, plus a max
110
layout. Floating and fullscreen are independent of the selected layout.
111
112
See `man swm` for the full set of key bindings.
113
114
115
# BARS AND STATUS
116
117
swm has no built-in bar. A layer-shell bar such as Waybar[2] can use the
118
`ext/workspaces` module, backed by swm's ext-workspace-v1 implementation. Each
119
output has its own workspace group, so the active button identifies the
120
workspace shown on that output. Empty inactive workspaces are advertised as
121
hidden; occupied workspaces remain visible. See `swmctl(1)` for workspace
122
metadata and Waybar integration.
123
124
On each state change swm also writes line-oriented status records to standard
125
output. When `-s` is used, that output is connected to the startup command's
126
standard input. Workspace metadata uses `workspace N title VALUE` and
127
`workspace N color #RRGGBBAA` records; empty values mean unset. Use
128
`swmctl events --filter=active-window` to receive the active window title for
129
a custom bar module.
130
`swmctl window regions` prints visible window rectangles in the format accepted
131
by `slurp -r`.
132
133
134
# TESTING AND DEVELOPMENT
135
136
Run the complete test suite with:
137
138
    make test
139
140
Make builds one focused C unit-test binary and a test compositor, then the
141
Python runner executes them alongside native Wayland and XWayland clients,
142
including a two-output run. Unchanged binaries are reused; use the narrower
143
targets while developing:
144
145
    make test-unit
146
    make test-integration
147
148
Coverage is informational and has its own target:
149
150
    make coverage
151
152
Generated test files live under `test/.build/`; remove them with
153
`make test-clean`. All targets require Python 3 and the normal build
154
dependencies. Integration tests additionally require PyWayland and its protocol
155
scanner, xcffib, wlr-randr, and Xwayland; coverage requires LLVM's coverage
156
tools.
157
158
Other development targets are:
159
160
    make man       # build swm.1 from swm.1.adoc
161
    make fmt       # format tracked C sources with clang-format
162
    make analyze   # rebuild under scan-build
163
    make clean
164
165
166
# LICENSE
167
168
swm inherits code and design from dwl, dwm, spectrwm, sway, and TinyWL. See
169
`LICENSE` and the `LICENSE.*` files for the applicable terms and attribution.
170
171
[0]: https://codeberg.org/dwl/dwl
172
[1]: https://github.com/conformal/spectrwm
173
[2]: https://github.com/Alexays/Waybar