Feel free to join our IRC channel on Libera.Chat at #sxwm. Contributions are welcome! Please read CONTRIBUTIONS.md for more information.
Warning
From commit 7a7c6300, master_previous binding has now been renamed to master_prev.
Please update your sxwmrc accordingly.
Note
The codebase of SXWM has certainly inflated a lot. Although it's nearing the same amount of code as dwm,
that doesn't mean that it's gotten more bloated, rather the opposite is true. I have been cleaning up and
refactoring the code so that it's more readable and faster; this does not affect the performance.
- Launch Args
- Features
- Screenshots
- Configuration
- Keybindings
- Dependencies
- Build & Install
- Makefile Targets
- Thanks & Inspiration
Displays the current version of sxwm
Allows user to use backup keybinds with sxwm
- Tiling & Floating: Switch seamlessly between layouts.
- Workspaces: 9 workspaces, fully integrated with your bar.
- Scratchpads: Floating windows you can summon/hide instantly.
- Window Swallowing: Native window swallowing support.
- Hot Reload: Apply custom configuration and reload with custom keybind.
- Easy Config: User-friendly
sxwmrcfile, no C required. - Master-Stack Layout: DWM-inspired productive workflow.
- Mouse Support: Move, swap, and resize windows with the mouse.
- Minimal Dependencies: Only
libX11,XineramaandXCursorare required. - Lightweight: Single C file, minimal headers, compiles in seconds.
- Xinerama Support: Multi-monitor ready.
- Efficient: Designed for speed and low resource usage(2-3 Mbs of RAM).
sxwm is configured via a simple text file located at ~/.config/sxwmrc. Changes can be applied instantly by reloading the configuration (MOD + r).
The file uses a key : value format. Lines starting with # are ignored.
| Option | Type | Default | Description |
|---|---|---|---|
mod_key |
String | super |
Sets the primary modifier key (alt, super, ctrl). |
gaps |
Integer | 10 |
Pixels between windows and screen edges. |
border_width |
Integer | 1 |
Thickness of window borders in pixels. |
focused_border_colour |
Hex | #c0cbff |
Border color for the currently focused window. |
unfocused_border_colour |
Hex | #555555 |
Border color for unfocused windows. |
swap_border_colour |
Hex | #fff4c0 |
Border color when selecting a window to swap (MOD+Shift+Drag). |
master_width |
Integer | 60 |
Percentage of the screen width for the master window. |
resize_master_amount |
Integer | 1 |
Percent to increase/decrease master width. |
resize_stack_amount |
Integer | 20 |
How many pixels to increase/decrease stack windows by |
snap_distance |
Integer | 5 |
Distance (px) before a floating window snaps to edge. |
motion_throttle |
Integer | 60 |
Target FPS for mouse drag actions. |
should_float |
String | "st" |
Always-float rule. Multiple entries should be comma-seperated. Optionally, entries can be enclosed in quotes. |
start_fullscreen |
String | "st" |
Starts specified windows that should start fullscreened. Enclosed in quotes and comma-seperated |
new_win_focus |
Bool | true |
Whether openening new windows should also set focus to them or keep on current window. |
warp_cursor |
Bool | true |
Warp the cursor to the middle of newly focused windows |
exec |
String | Nothing |
Command to run on startup (e.g., sxbar, picom, "autostart", etc.). |
can_swallow |
String | st |
Windows that can swallow. |
can_be_swallowed |
String | mpv |
Windows that can be swallowed. |
new_win_master |
Bool | false |
New windows will open as master window. |
- Modifiers:
mod,shift,ctrl,alt,super - Key: Case-insensitive keysym (e.g.,
Return,q,1) - Action: Either an external command (in quotes) or internal function.
- move: Move to that worspace
- swap: Swap window to that workspace
- n: Workspace / Scratchpad number
- create: Creates a scratchpad on that slot
- toggle: toggles the visibility of that scratchpad
- remove: Removes the scratchpad on that slot
bind : modifier + modifier + ... + key : actionscratchpad : modifier + ... + key : create n
scratchpad : modifier + ... + key : toggle n
scratchpad : modifier + ... + key : remove nworkspace : modifier + modifier + ... + key : move n
workspace : modifier + modifier + ... + key : swap n| Function Name | Description |
|---|---|
close_window |
Closes the focused window. |
decrease_gaps |
Shrinks gaps. |
focus_next |
Moves focus forward in the stack. |
focus_prev |
Moves focus backward in the stack. |
focus_next_mon |
Switches focus to the next monitor. |
focus_prev_mon |
Switches focus to the previous monitor. |
move_next_mon |
Moves the focused window to the next monitor. |
move_prev_mon |
Moves the focused window to the previous monitor. |
increase_gaps |
Expands gaps. |
master_next |
Moves focused window down in master/stack order. |
master_prev |
Moves focused window up in master/stack order. |
quit |
Exits sxwm. |
reload_config |
Reloads config. |
master_increase |
Expands master width. |
master_decrease |
Shrinks master width. |
toggle_floating |
Toggles floating state of current window. |
global_floating |
Toggles floating state for all windows. |
fullscreen |
Fullscreen the focused window. |
centre_window |
Centre the focused window. |
# Launch terminal
bind : mod + Return : "st"
# Close window
bind : mod + shift + q : close_window
# Scratchpads
scratchpad : mod + ctrl + Return : create 1
scratchpad : mod + shift + b : toggle 2
scratchpad : mod + alt + b : remove 2
# Switch workspace
workspace : mod + 3 : move 3
# Move window to workspace
workspace : mod + shift + 5 : swap 5| Combo | Action |
|---|---|
Mouse |
Focus on click under cursor |
MOD + Left Mouse |
Move window with mouse |
MOD + Right Mouse |
Resize window with mouse |
MOD + j / k |
Focus next / previous |
MOD + Shift + j / k |
Move window in master stack |
MOD + , / . |
Focus prev / next monitor |
MOD + Shift + , / . |
Move window to prev / next monitor |
MOD + h / l |
Resize master area (decr/incr) |
MOD + Ctrl + h / l |
Resize stack area (decr/incr) |
MOD + = / - |
Increase / decrease gaps |
MOD + Space |
Toggle floating |
MOD + Shift + Space |
Toggle all floating |
MOD + Shift + f |
Toggle fullscreen for focused window |
MOD + Shift + q |
Close focused window |
MOD + Shift + e |
Quit sxwm |
MOD + r |
Reload configuration |
MOD + c |
Centre window |
| Combo | Action |
|---|---|
MOD + Alt + 1–4 |
Create scratchpad 1–5 |
MOD + Ctrl + 1–4 |
Toggle scratchpad 1–5 |
MOD + Alt + Shift + 1–4 |
Remove scratchpad 1–5 |
| Combo | Action |
|---|---|
MOD + 1–9 |
Switch to workspace 1–9 |
MOD + Shift + 1–9 |
Move window to workspace 1–9 |
| Combo | Action | Program |
|---|---|---|
MOD + Return |
Open terminal | st |
MOD + b |
Open browser | firefox |
MOD + p |
Run launcher | dmenu_run |
libX11(Xorg client library)XineramaXCursor- GCC or Clang & Make
Debian / Ubuntu / Linux Mint
sudo apt update
sudo apt install libx11-dev libxcursor-dev libxinerama-dev build-essentialArch Linux / Manjaro
sudo pacman -Syy
sudo pacman -S libx11 libxinerama gcc makeGentoo
sudo emerge --ask x11-libs/libX11 x11-libs/libXinerama sys-devel/gcc sys-devel/make
sudo emaint -a sync
Void Linux
sudo xbps-install -S
sudo xbps-install libX11-devel libXinerama-devel libXcursor-devel gcc makeFedora / RHEL / AlmaLinux / Rocky
sudo dnf update
sudo dnf install libX11-devel libXcursor-devel libXinerama-devel gcc makeOpenSUSE (Leap / Tumbleweed)
sudo zypper refresh
sudo zypper install libX11-devel libXinerama-devel gcc makeAlpine Linux
doas apk update
doas apk add libx11-dev libxinerama-dev gcc make musl-dev linux-headersNixOS
buildInputs = [
pkgs.xorg.libX11
pkgs.xorg.libXinerama
pkgs.libgcc
pkgs.gnumake
];
sudo nixos-rebuild switch
Slackware
slackpkg update
slackpkg install gcc make libX11 libXineramaOpenBSD
doas pkg_add gmakexbase, xfonts, xserv and xshare) installed.
When you make the code, use gmake instead of make (which will be BSD make). Use the following command to build: gmake CFLAGS="-I/usr/X11R6/include -Wall -Wextra -O3 -Isrc" LDFLAGS="-L/usr/X11R6/lib -lX11 -lXinerama -lXcursor"
FreeBSD
# If you use doas or su instead of sudo, modify the following commands accordingly.
sudo pkg update
sudo pkg install gcc gmake libX11 libXineramaTermux
pkg install x11-repo
pkg update
pkg install clang make xcb-util-keysyms xorgproto libxcursor libx11 libxinerama libandroid-wordexp
# add `LDFLAGS="${LDFLAGS} -landroid-wordexp"` in the make command
yay -S sxwm
# OR for latest features:
yay -S sxwm-gitsudo xbps-install -S sxwmgit clone --depth=1 https://github.com/uint23/sxwm.git
cd sxwm/
# Replace make with gmake on FreeBSD
make
sudo make clean installAdd to your ~/.xinitrc:
exec sxwm| Target | Description |
|---|---|
make / make all |
Build the sxwm binary |
make clean |
Remove build artifacts |
make install |
Install sxwm to $(PREFIX)/bin (default /usr/local) |
make uninstall |
Remove installed binary |
make clean install |
Clean then install |
Override install directory with
PREFIX:make install PREFIX=$HOME/.local
- dwm — Tiling & source code
- i3 — Easy configuration
- sowm — README inspiration
- tinywm — Minimal X11 WM
Abhinav Prasai [2025]