A fork of dwl with Janet scripting.
dwl-janet lets you configure your Wayland compositor with a Lisp instead of recompiling C. Edit your config, save, and changes apply instantly.
- Hot-reload: Config reloads automatically when you save
- Janet scripting: Keybindings, layouts, and actions in a Clojure-like Lisp
- Custom layouts: Write tiling layouts as Janet functions
- Everything else from dwl: Tags, master-stack tiling, multi-monitor, wlroots-based
Dependencies:
- libinput
- wayland
- wlroots (compiled with the libinput backend)
- xkbcommon
- wayland-protocols (compile-time only)
- pkg-config (compile-time only)
dwl has the following additional dependencies if XWayland support is enabled:
- libxcb
- libxcb-wm
- wlroots (compiled with X11 support)
- Xwayland (runtime only)
Install these (and their -devel versions if your distro has separate
development packages) and run make.
To enable XWayland, uncomment the flags in config.mk.
dwl-janet looks for config.janet in these locations (in order):
$XDG_CONFIG_HOME/dwl/config.janet~/.config/dwl/config.janet./config.janet(current directory, for development)
The config file is automatically reloaded when saved. No restart needed.
- Keybindings: Define all keyboard shortcuts in Janet
- Layouts: Write custom tiling layouts as Janet functions
- Actions: spawn programs, focus windows, manage tags, etc.
# Import dwl functions
(def spawn (in dwl :spawn))
(def bind-key (in dwl :bind-key))
(def focus-stack (in dwl :focus-stack))
# Modifier keys
(def MOD-LOGO 64) # Super key
# Keysyms
(def XK-Return 0xff0d)
(def XK-j 0x006a)
# Keybindings
(bind-key MOD-LOGO XK-Return (fn [] (spawn "kitty")))
(bind-key MOD-LOGO XK-j (fn [] (focus-stack 1)))See config.janet for a complete example with layouts and all keybindings.
| Function | Description |
|---|---|
(dwl :spawn) |
Spawn a program |
(dwl :bind-key) |
Register a keybinding |
(dwl :focus-stack) |
Focus next/prev window |
(dwl :set-mfact) |
Adjust master area size |
(dwl :inc-nmaster) |
Change number of masters |
(dwl :kill-client) |
Close focused window |
(dwl :toggle-floating) |
Toggle floating mode |
(dwl :toggle-fullscreen) |
Toggle fullscreen |
(dwl :view) |
Switch to tag |
(dwl :tag) |
Move window to tag |
(dwl :set-layout) |
Set layout by symbol |
(dwl :resize) |
Resize a client (for layouts) |
(dwl :log) |
Print to stderr |
Layouts are Janet functions that receive monitor info and a list of clients:
(defn my-layout [mon clients]
(each c clients
(resize (c :ptr)
(mon :x) (mon :y)
(mon :width) (mon :height))))See config.janet for examples: tile, monocle, grid, centered-master, spiral.
dwl-janet can run nested inside an existing Wayland or X11 session (useful for testing), or directly from a VT console.
# Nested (for testing)
./dwl
# With a startup script
dwl -s 'waybar <&-'For running from a VT, you may need to add yourself to video and input groups,
or use elogind/systemd-logind with polkit.
Status info (tags, layout, window title) is written to the -s command's stdin.
Use <&- to close stdin if your startup command doesn't consume it.
dwl-janet is a fork of dwl, which was created by Devin J. Pohly and built on wlroots.
Janet scripting integration by Claude Code.
See LICENSE files in the repository.