summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile4
-rw-r--r--README.md228
-rw-r--r--docs/sxwm.1164
-rw-r--r--docs/sxwm.desktop (renamed from sxwm.desktop)0
-rw-r--r--docs/sxwm.md133
-rw-r--r--src/defs.h4
-rw-r--r--src/parser.c16
-rw-r--r--sxwm.1460
8 files changed, 327 insertions, 682 deletions
diff --git a/Makefile b/Makefile
index c283518..f922a64 100644
--- a/Makefile
+++ b/Makefile
@@ -6,7 +6,7 @@ PKG_CONFIG ?= pkg-config
PREFIX ?= /usr/local
DESTDIR ?=
BIN := sxwm
-MAN := sxwm.1
+MAN := docs/sxwm.1
MAN_DIR := $(PREFIX)/share/man/man1
XSESSIONS := $(DESTDIR)$(PREFIX)/share/xsessions
@@ -66,7 +66,7 @@ install: all
@install -m 755 $(BIN) "$(DESTDIR)$(PREFIX)/bin/$(BIN)"
@echo "installing sxwm.desktop to $(XSESSIONS)..."
@mkdir -p "$(XSESSIONS)"
- @install -m 644 sxwm.desktop "$(XSESSIONS)/sxwm.desktop"
+ @install -m 644 docs/sxwm.desktop "$(XSESSIONS)/sxwm.desktop"
@echo "installing man page to $(DESTDIR)$(MAN_DIR)..."
@mkdir -p "$(DESTDIR)$(MAN_DIR)"
@install -m 644 $(MAN) "$(DESTDIR)$(MAN_DIR)/"
diff --git a/README.md b/README.md
index 1d31329..67d314d 100644
--- a/README.md
+++ b/README.md
@@ -1,226 +1,32 @@
<div align="center">
- <img src="images/sxwm_logo.png" width="50%">
+ <img src="logo.png" width="50%">
<br>
- <b>Minimal, fast, configurable. Tiling X11 window manager.</b>
+ <b>A very SeXy WM</b>
<br><br>
<img src="https://img.shields.io/github/v/release/uint23/sxwm?style=flat-square">
<img src="https://img.shields.io/github/license/uint23/sxwm?style=flat-square">
</div>
-Feel free to join our IRC channel on [Libera.Chat at #sxwm](https://web.libera.chat/?channels=#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.
-
-## Table of Contents
-- [Launch Args](#launch-args)
-- [Features](#features)
-- [Screenshots](#screenshots)
-- [Configuration](#configuration)
-- [Keybindings](#keybindings)
- - [Example Bindings](#example-bindings)
- - [Default Keybindings](#default-keybindings)
-- [Dependencies](#dependencies)
-- [Build & Install](#build--install)
-- [Makefile Targets](#makefile-targets)
-- [Thanks & Inspiration](#thanks--inspiration)
-
---
-## Launch Arguments
+## Contributions & Issues
-### `-v` or `--version`
-Displays the current version of `sxwm`
-
-### `-b` or `--backup`
-Allows user to use backup keybinds with `sxwm`
+Please read [the contribution guide](docs/CONTRIBUTIONS.md)
---
-## Features
-
-- **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 `sxwmrc` file, no C required.
-- **Master-Stack Layout**: DWM-inspired productive workflow.
-- **Mouse Support**: Move, swap, and resize windows with the mouse.
-- **Minimal Dependencies**: Only `libX11`, `Xinerama` and `XCursor` are 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).
-
----
+## Features & Configuration
-## Configuration
-
-`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.
-
-### General Options
-
-| 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. |
-
----
-
-## Keybindings
-
-### Syntax
-
-- **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
-
-```sh
-bind : modifier + modifier + ... + key : action
-```
-
-```sh
-scratchpad : modifier + ... + key : create n
-scratchpad : modifier + ... + key : toggle n
-scratchpad : modifier + ... + key : remove n
-```
-
-```sh
-workspace : modifier + modifier + ... + key : move n
-workspace : modifier + modifier + ... + key : swap n
-```
-
-### Available Functions
-
-| 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. |
-
-### Example Bindings
-
-```yaml
-# 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
-```
-
----
-
-## Default Keybindings
-
-### Window Management
-| 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 |
-
-### Scratchpads
-
-| 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 |
-
-### Workspaces
-
-| Combo | Action |
-| ----------------------- | ---------------------------- |
-| `MOD` + `1–9` | Switch to workspace 1–9 |
-| `MOD` + `Shift` + `1–9` | Move window to workspace 1–9 |
-
-### Applications
-
-| Combo | Action | Program |
-| ---------------- | ------------- | ----------- |
-| `MOD` + `Return` | Open terminal | `st` |
-| `MOD` + `b` | Open browser | `firefox` |
-| `MOD` + `p` | Run launcher | `dmenu_run` |
+Check [the man page markdown for relevant info](docs/sxwm.md)
---
## Dependencies
-- `libX11` (Xorg client library)
+- `libX11`
- `Xinerama`
- `XCursor`
-- GCC or Clang & Make
+- CC & Make
<details>
<summary>Debian / Ubuntu / Linux Mint</summary>
@@ -312,7 +118,9 @@ pkg install clang make xcb-util-keysyms xorgproto libxcursor libx11 libxinerama
### Arch Linux (AUR)
-```sh
+> [!NOTE]
+> I don't maintain any packages. Use with caution!
+
yay -S sxwm
# OR for latest features:
yay -S sxwm-git
@@ -329,9 +137,8 @@ sudo xbps-install -S sxwm
```sh
git clone --depth=1 https://github.com/uint23/sxwm.git
cd sxwm/
-# Replace make with gmake on FreeBSD
make
-sudo make clean install
+sudo/doas make clean install
```
### Run
@@ -340,6 +147,7 @@ Add to your `~/.xinitrc`:
```sh
exec sxwm
```
+Or use the `sxwm.desktop` file
---
## Makefile Targets
@@ -361,13 +169,13 @@ exec sxwm
## Thanks & Inspiration
-- [dwm](https://dwm.suckless.org) — Tiling & source code
-- [i3](https://i3wm.org) — Easy configuration
-- [sowm](https://github.com/dylanaraps/sowm) — README inspiration
-- [tinywm](http://incise.org/tinywm.html) — Minimal X11 WM
+- [dwm](https://dwm.suckless.org) - Tiling & source code
+- [i3](https://i3wm.org) - Easy configuration
+- [sowm](https://github.com/dylanaraps/sowm) - README inspiration
+- [tinywm](http://incise.org/tinywm.html) - Minimal X11 WM
---
<p align="center">
- <em>Abhinav Prasai [2025]</em>
+ <em>uint [2025]</em>
</p>
diff --git a/docs/sxwm.1 b/docs/sxwm.1
new file mode 100644
index 0000000..6604a0e
--- /dev/null
+++ b/docs/sxwm.1
@@ -0,0 +1,164 @@
+.TH SXWM 1 "October 2025" "sxwm" "User Commands"
+.SH NAME
+sxwm \- simple X11 window manager
+.SH SYNOPSIS
+.B sxwm
+[\-v | \-\-version]
+.SH DESCRIPTION
+.B sxwm
+is a minimal, user-friendly tiling window manager for X11.
+It is configured through a plain text file and supports on-the-fly reconfiguration.
+
+.SH LAUNCH ARGUMENTS
+.TP
+.B \-v, \-\-version
+Displays the current version of
+.B sxwm.
+
+.SH CONFIGURATION
+.B sxwm
+is configured via a simple text file located at
+.I ~/.config/sxwmrc.
+Changes can be applied instantly by reloading the configuration (MOD + r).
+
+The file uses a
+.B key : value
+format. Lines starting with
+.B #
+are ignored.
+
+.SS General Options
+.TS
+allbox;
+c c c c
+l l l l.
+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.
+motion_throttle Integer 60 Target FPS for mouse drag actions.
+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.
+move_window_amount Integer 10 Number of pixels to move the window with keyboard.
+resize_window_amount Integer 10 Number of pixels to resize the window with keyboard.
+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.
+floating_on_top Bool true Whether floating windows should always draw over tiled ones
+floating_on_top Bool true Whether floating windows should always draw over tiled ones
+new_win_master Bool false New windows will open as master window.
+should_float String "st" Always-float rule. Multiple entries should be comma-seperated. Optionally, entries can be enclosed in quotes.
+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.
+.TE
+
+.SH KEYBINDINGS
+.SS Syntax
+Modifiers: mod, shift, ctrl, alt, super ...
+.br
+Key: Case-insensitive keysym (e.g., Return, q, 1)
+.RS
+To find the key do
+.B xev | grep "keysym"
+and press the key in the box.
+.RE
+Action: Either an external command (in quotes) or internal function.
+.br
+move: Move to that workspace
+.br
+swap: Swap window to that workspace
+.br
+_n_: Workspace / Scratchpad number
+.br
+create: Creates a scratchpad on that slot
+.br
+toggle: Toggles the visibility of that scratchpad
+.br
+remove: Removes the scratchpad on that slot
+
+.PP
+Example syntax:
+.PP
+.EX
+bind : modifier + ... + key : action
+.EE
+.PP
+.EX
+scratchpad : modifier + ... + key : create n
+scratchpad : modifier + ... + key : toggle n
+scratchpad : modifier + ... + key : remove n
+.EE
+.PP
+.EX
+workspace : modifier + ... + key : move n
+workspace : modifier + ... + key : swap n
+.EE
+
+.SS Available Functions
+.TS
+allbox;
+c c
+l l.
+Function Name Description
+_
+centre_window Centre the focused window.
+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.
+fullscreen Fullscreen the focused window.
+global_floating Toggles floating state for all windows.
+increase_gaps Expands gaps.
+master_next Moves focused window down in master/stack order.
+master_prev Moves focused window up in master/stack order.
+master_increase Expands master width.
+master_decrease Shrinks master width.
+move_next_mon Moves the focused window to the next monitor.
+move_prev_mon Moves the focused window to the previous monitor.
+move_win_up Moves the focused window up (keyboard).
+move_win_down Moves the focused window down (keyboard).
+move_win_left Moves the focused window left (keyboard).
+move_win_right Moves the focused window right (keyboard).
+quit Exits sxwm.
+reload_config Reloads config.
+resize_win_up Resizes the focused window up (keyboard).
+resize_win_down Resizes the focused window down (keyboard).
+resize_win_left Resizes the focused window left (keyboard).
+resize_win_right Resizes the focused window right (keyboard).
+stack_increase Increase the height of the focused stack window.
+stack_decrease Decrease the height of the focused stack window.
+switch_previous_workspace Switch to the previous workspace.
+toggle_floating Toggles floating state of current window.
+.TE
+
+.SS Example Bindings
+.EX
+# 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
+.EE
+
+.SH DEFAULT KEYBINDINGS
+In
+.I default_sxwmrc
+file.
diff --git a/sxwm.desktop b/docs/sxwm.desktop
index ef08338..ef08338 100644
--- a/sxwm.desktop
+++ b/docs/sxwm.desktop
diff --git a/docs/sxwm.md b/docs/sxwm.md
new file mode 100644
index 0000000..9b844d6
--- /dev/null
+++ b/docs/sxwm.md
@@ -0,0 +1,133 @@
+## Launch Arguments
+
+### `-v` or `--version`
+Displays the current version of `sxwm`
+
+
+## Configuration
+
+`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.
+
+### General Options
+
+| 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. |
+| `motion_throttle` | Integer | `60` | Target FPS for mouse drag actions. |
+| `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. |
+| `move_window_amount` | Integer | `10` | Number of pixels to move the window with keyboard. |
+| `resize_window_amount` | Integer | `10` | Number of pixels to resize the window with keyboard. |
+| `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. |
+| `floating_on_top` | Bool | `true` | Whether floating windows should always draw over tiled ones |
+| `floating_on_top` | Bool | `true` | Whether floating windows should always draw over tiled ones |
+| `new_win_master` | Bool | `false` | New windows will open as master window. |
+| `should_float` | String | `"st"` | Always-float rule. Multiple entries should be comma-seperated. Optionally, entries can be enclosed in quotes.|
+| `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. |
+
+---
+
+## Keybindings
+
+### Syntax
+
+- **Modifiers**: `mod`, `shift`, `ctrl`, `alt`, `super` ...
+- **Key**: Case-insensitive keysym (e.g., `Return`, `q`, `1`)
+> To find the key do `xev | grep "keysym"` and press the key in the box.
+- **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
+
+```sh
+bind : modifier + ... + key : action
+```
+
+```sh
+scratchpad : modifier + ... + key : create n
+scratchpad : modifier + ... + key : toggle n
+scratchpad : modifier + ... + key : remove n
+```
+
+```sh
+workspace : modifier + ... + key : move n
+workspace : modifier + ... + key : swap n
+```
+
+### Available Functions
+
+| Function Name | Description |
+|----------------------|--------------------------------------------------------------|
+| `centre_window` | Centre the focused window. |
+| `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. |
+| `fullscreen` | Fullscreen the focused window. |
+| `global_floating` | Toggles floating state for all windows. |
+| `increase_gaps` | Expands gaps. |
+| `master_next` | Moves focused window down in master/stack order. |
+| `master_prev` | Moves focused window up in master/stack order. |
+| `master_increase` | Expands master width. |
+| `master_decrease` | Shrinks master width. |
+| `move_next_mon` | Moves the focused window to the next monitor. |
+| `move_prev_mon` | Moves the focused window to the previous monitor. |
+| `move_win_up` | Moves the focused window up (keyboard). |
+| `move_win_down` | Moves the focused window down (keyboard). |
+| `move_win_left` | Moves the focused window left (keyboard). |
+| `move_win_right` | Moves the focused window right (keyboard). |
+| `quit` | Exits `sxwm`. |
+| `reload_config` | Reloads config. |
+| `resize_win_up` | Resizes the focused window up (keyboard). |
+| `resize_win_down` | Resizes the focused window down (keyboard). |
+| `resize_win_left` | Resizes the focused window left (keyboard). |
+| `resize_win_right` | Resizes the focused window right (keyboard). |
+| `stack_increase` | Increase the height of the focused stack window. |
+| `stack_decrease` | Decrease the height of the focused stack window. |
+| `switch_previous_workspace` | Switch to the previous workspace. |
+| `toggle_floating` | Toggles floating state of current window. |
+
+### Example Bindings
+
+```yaml
+# 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
+```
+
+---
+
+## Default Keybindings
+
+In `default_sxwmrc`
+
+---
diff --git a/src/defs.h b/src/defs.h
index b8dd19d..1e59e50 100644
--- a/src/defs.h
+++ b/src/defs.h
@@ -120,8 +120,8 @@ typedef struct {
typedef struct {
int x, y;
int w, h;
- int reserve_left, reserve_right,
- reserve_top, reserve_bottom;
+ int reserve_left, reserve_right;
+ int reserve_top, reserve_bottom;
} Monitor;
typedef struct {
diff --git a/src/parser.c b/src/parser.c
index f1dd7c0..f670ec6 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -19,36 +19,36 @@
#include "defs.h"
static const CommandEntry call_table[] = {
+ {"centre_window", centre_window},
{"close_window", close_focused},
{"decrease_gaps", dec_gaps},
{"focus_next", focus_next},
{"focus_prev", focus_prev},
{"focus_next_mon", focus_next_mon},
{"focus_prev_mon", focus_prev_mon},
+ {"fullscreen", toggle_fullscreen},
+ {"global_floating", toggle_floating_global},
{"increase_gaps", inc_gaps},
{"master_next", move_master_next},
{"master_prev", move_master_prev},
+ {"master_increase", resize_master_add},
+ {"master_decrease", resize_master_sub},
{"move_next_mon", move_next_mon},
{"move_prev_mon", move_prev_mon},
{"move_win_up", move_win_up},
{"move_win_down", move_win_down},
{"move_win_left", move_win_left},
{"move_win_right", move_win_right},
+ {"quit", quit},
+ {"reload_config", reload_config},
{"resize_win_up", resize_win_up},
{"resize_win_down", resize_win_down},
{"resize_win_left", resize_win_left},
{"resize_win_right", resize_win_right},
- {"quit", quit},
- {"reload_config", reload_config},
- {"master_increase", resize_master_add},
- {"master_decrease", resize_master_sub},
{"stack_increase", resize_stack_add},
{"stack_decrease", resize_stack_sub},
- {"toggle_floating", toggle_floating},
- {"global_floating", toggle_floating_global},
- {"fullscreen", toggle_fullscreen},
- {"centre_window", centre_window},
{"switch_previous_workspace", switch_previous_workspace},
+ {"toggle_floating", toggle_floating},
{NULL, NULL},
};
diff --git a/sxwm.1 b/sxwm.1
deleted file mode 100644
index c59076f..0000000
--- a/sxwm.1
+++ /dev/null
@@ -1,460 +0,0 @@
-.TH sxwm 1 "June 2025" "sxwm 1.6" "User Commands"
-
-.SH NAME
-sxwm \- minimal, fast, and configurable tiling window manager for X11
-
-.SH SYNOPSIS
-.B sxwm
-[\fIOPTION\fR]
-
-.SH DESCRIPTION
-sxwm is a lightweight and efficient tiling window manager for X11, designed to be fast, minimal, and easy to configure. It supports workspaces, floating windows, mouse operations, and dynamic configuration reloading.
-
-.SH FEATURES
-Tiling and floating layouts.
-Nine workspaces with full bar support.
-Scratchpads for instant access to floating windows.
-Native windwo swallowing.
-Live configuration reload without restart.
-Human-friendly configuration file requiring no recompilation.
-DWM-style master-stack layout.
-Mouse support for moving, resizing, and swapping windows.
-Depends only on libX11, Xinerama, and XCursor.
-Extremely lightweight (single C file).
-Multi-monitor support via Xinerama.
-Works well with external bars such as sxbar.
-Zero dependencies beyond X11 libraries.
-Fast and low resource usage.
-
-.SH LAUNCH ARGUMENTS
-
-.TP
-.B \-v, \-\-version
-Displays current sxwm version
-
-.TP
-.B \-b, \-\-backup
-Uses default config along side the custom sxwmrc
-
-.SH CONFIGURATION
-The configuration file is located at
-.B ~/.config/sxwmrc
-
-It uses a simple key : value format. Lines starting with `#` are treated as comments.
-
-General options include:
-
-.TP
-.B mod_key
-Sets the primary modifier key ("alt", "super", or "ctrl"). Default is "super".
-
-.TP
-.B gaps
-Pixels between windows and screen edges. Default is 10.
-
-.TP
-.B border_width
-Thickness of window borders in pixels. Default is 1.
-
-.TP
-.B focused_border_colour
-Border color for the focused window. Default is "#c0cbff".
-
-.TP
-.B unfocused_border_colour
-Border color for unfocused windows. Default is "#555555".
-
-.TP
-.B swap_border_colour
-Border color highlight when selecting a window to swap with. Default is "#fff4c0".
-
-.TP
-.B master_width
-Percentage of screen width allocated to the master window. Default is 60.
-
-.TP
-.B resize_master_amount
-Percentage to increase or decrease master width when resizing. Default is 1.
-
-.TP
-.B resize_stack_amount
-How many pixels to increase/decrease stack windows by. Default is 20.
-
-.TP
-.B snap_distance
-Pixels from screen edge before a floating window snaps to the edge. Default is 5.
-
-.TP
-.B motion_throttle
-Target updates per second for mouse drag operations (move, resize, swap). Default is 60.
-
-.TP
-.B should_float
-Lets you change which windows should float by default when opening them. Multiple entries should be comma-separated. Optionally, entries can be enclosed in quotes. Default is "pcmanfm", "obs".
-
-.TP
-.B start_fullscreen
-Lets you specify which windows should start in fullscreen mode. Multiple entries should be comma-separated. Optionally, entries can be enclosed in quotes. Default is "mpv", "vlc".
-
-.TP
-.B new_win_focus
-Whether newly opened windows should automatically gain focus. Default is true.
-
-.TP
-.B warp_cursor
-If true, warps the mouse cursor to the center of newly focused windows. Default is true.
-
-.TP
-.B exec
-Command to run on startup (e.g., "sxbar", "picom", "autostart", etc.).
-
-.TP
-.B can_swallow
-Windows that can swallow other windows. Default is "st".
-
-.TP
-.B can_be_swallowed
-Windows that can be swallowed by others. Default is "mpv".
-
-.TP
-.B new_win_as_master
-New windows will take place as the master window
-
-.SH KEYBINDINGS
-Keybindings associate key combinations with actions, either running external commands or internal sxwm functions.
-
-They follow this syntax:
-
-.TP
-.B bind : modifier + ... + key : action
-
-Modifiers can be mod, shift, ctrl, alt, or super. The key is the final key name (e.g., Return, q, 1, equal, space).
-
-Actions can be either a quoted external command or an internal function name.
-
-.TP
-.B workspace : modifier + ... + key : move n
-.TP
-.B workspace : modifier + ... + key : swap n
-
-For workspace switching and moving windows. n is the workspace number (1-9).
-
-.TP
-.B scratchpad : modifier + ... + key : create n
-.TP
-.B scratchpad : modifier + ... + key : toggle n
-.TP
-.B scratchpad : modifier + ... + key : remove n
-
-For scratchpad management. create assigns the focused window to scratchpad n, toggle shows/hides scratchpad n, and remove returns the scratchpad window to normal tiling. n is the scratchpad number (1-5).
-
-Example bindings:
-
-.TP
-.B bind : mod + Return : "st"
-Open the st terminal.
-
-.TP
-.B bind : mod + shift + q : close_window
-Close any window that is selected.
-
-.TP
-.B workspace : mod + 3 : move 3
-Go to workspace 3.
-
-.TP
-.B workspace : mod + shift + 5 : swap 5
-Move selected window to workspace 5.
-
-.TP
-.B scratchpad : mod + alt + 1 : create 1
-Assign focused window to scratchpad 1.
-
-.TP
-.B scratchpad : mod + ctrl + 1 : toggle 1
-Show or hide scratchpad 1.
-
-.TP
-.B scratchpad : mod + alt + shift + 1 : remove 1
-Remove window from scratchpad 1 and return to normal tiling.
-
-.SH AVAILABLE FUNCTIONS
-The following internal functions are available for keybindings:
-
-.TP
-.B close_window
-Closes the currently focused window.
-
-.TP
-.B centre_window
-Centers the focused window.
-
-.TP
-.B decrease_gaps
-Decreases the gap size between windows.
-
-.TP
-.B focus_next
-Shifts focus to the next window in the stack.
-
-.TP
-.B focus_previous
-Shifts focus to the previous window in the stack.
-
-.TP
-.B focus_next_mon
-Switches focus to the next monitor.
-
-.TP
-.B focus_prev_mon
-Switches focus to the previous monitor.
-
-.TP
-.B move_next_mon
-Moves the focused window to the next monitor.
-
-.TP
-.B move_prev_mon
-Moves the focused window to the previous monitor.
-
-.TP
-.B increase_gaps
-Increases the gap size between windows.
-
-.TP
-.B master_next
-Moves the focused window down the master/stack order.
-
-.TP
-.B master_prev
-Moves the focused window up the master/stack order.
-
-.TP
-.B quit
-Exits sxwm.
-
-.TP
-.B reload_config
-Reloads the sxwmrc configuration file.
-
-.TP
-.B master_increase
-Increases the width allocated to the master area.
-
-.TP
-.B master_decrease
-Decreases the width allocated to the master area.
-
-.TP
-.B stack_increase
-Increases the height of stack window.
-
-.TP
-.B stack_decrease
-Decreases the height of stack window.
-
-.TP
-.B toggle_floating
-Toggles the floating state of the focused window.
-
-.TP
-.B global_floating
-Toggles the floating state for all windows on the current workspace.
-
-.TP
-.B fullscreen
-Toggles fullscreen mode for the focused window.
-
-.TP
-.B focus_next_mon
-Switches focus to the next monitor.
-
-.TP
-.B focus_prev_mon
-Switches focus to the previous monitor.
-
-.TP
-.B move_next_mon
-Moves the focused window to the next monitor.
-
-.TP
-.B move_prev_mon
-Moves the focused window to the previous monitor.
-
-.TP
-.B change_ws1 ... change_ws9
-Switches focus to the specified workspace (1 to 9).
-
-.TP
-.B moveto_ws1 ... moveto_ws9
-Moves the focused window to the specified workspace (1 to 9).
-
-.SH DEFAULT KEYBINDINGS
-Window Management:
-
-.TP
-.B Mouse Click
-Focus window under cursor.
-
-.TP
-.B MOD + Left Mouse
-Move window with mouse.
-
-.TP
-.B MOD + Right Mouse
-Resize window with mouse.
-
-.TP
-.B MOD + Return
-Launch terminal (default: st).
-
-.TP
-.B MOD + b
-Launch browser (default: firefox).
-
-.TP
-.B MOD + p
-Run launcher (default: dmenu_run).
-
-.TP
-.B MOD + Shift + q
-Close focused window.
-
-.TP
-.B MOD + Shift + e
-Quit sxwm.
-
-.TP
-.B MOD + r
-Reload configuration.
-
-.TP
-.B MOD + c
-Center focused window.
-
-.TP
-.B MOD + 1 to 9
-Switch to workspace 1 through 9.
-
-.TP
-.B MOD + Shift + 1 to 9
-Move focused window to workspace 1 through 9.
-
-.TP
-.B MOD + Alt + 1 to 4
-Create scratchpad 1 through 4.
-
-.TP
-.B MOD + Ctrl + 1 to 4
-Toggle scratchpad 1 through 4.
-
-.TP
-.B MOD + Alt + Shift + 1 to 4
-Remove scratchpad 1 through 4.
-
-.TP
-.B MOD + j / k
-Focus next or previous window.
-
-.TP
-.B MOD + Shift + j / k
-Move window up or down in the master stack.
-
-.TP
-.B MOD + h / l
-Resize master area (decrease/increase).
-
-.TP
-.B MOD + Ctrl + h / l
-Resize stack area (decrease/increase).
-
-.TP
-.B MOD + Space
-Toggle floating mode for focused window.
-
-.TP
-.B MOD + Shift + Space
-Toggle floating mode for all windows.
-
-.TP
-.B MOD + = / -
-Increase or decrease gaps.
-
-.TP
-.B MOD + Shift + f
-Toggle fullscreen mode.
-
-.TP
-.B MOD + . / ,
-Focus next/previous monitor.
-
-.TP
-.B MOD + Shift + . / ,
-Move focused window to next/previous monitor.
-
-.SH DEPENDENCIES
-sxwm requires the following libraries:
-
-.TP
-.B libX11
-Xorg client library
-
-.TP
-.B libXinerama
-Multi-monitor support
-
-.TP
-.B libXcursor
-Cursor support
-
-.TP
-.B GCC or Clang & Make
-For building from source
-
-.SH FILES
-Configuration file:
-.B ~/.config/sxwmrc
-
-.SH EXAMPLES
-Example configuration snippets:
-
-.RS
-.nf
-# Set gaps and borders
-gaps : 15
-border_width : 2
-focused_border_colour : "#ff6b6b"
-
-# Custom keybindings
-bind : mod + Return : "alacritty"
-bind : mod + d : "rofi -show drun"
-
-# Workspace switching
-workspace : mod + 1 : move 1
-workspace : mod + shift + 1 : swap 1
-
-# Scratchpad management
-scratchpad : mod + alt + 1 : create 1
-scratchpad : mod + ctrl + 1 : toggle 1
-scratchpad : mod + alt + shift + 1 : remove 1
-
-# Window swallowing
-can_swallow : "st"
-can_be_swallowed : "sxiv", "mpv", "zathura"
-.fi
-.RE
-
-.SH AUTHOR
-Written by Abhinav Prasai (uint23), 2025.
-
-.SH SEE ALSO
-sxbar(1), dmenu(1), st(1), X(7)
-
-.SH LICENSE
-MIT License. See the LICENSE file for full details.
-
-.SH BUGS
-Report bugs at: https://github.com/uint23/sxwm/issues
-
-.SH INSPIRATION
-sxwm draws inspiration from dwm, i3, sowm, and tinywm.