]> git.lizzy.rs Git - bspwm.git/blobdiff - README.md
bspwm: port rounded corners patch to latest version
[bspwm.git] / README.md
index 8727d4c5df91afa9c3bdffe98355564699864c61..4846a52b8107b9cf942680f275864f8814e8106e 100644 (file)
--- a/README.md
+++ b/README.md
-![logo](https://github.com/baskerville/bspwm/raw/master/logo/bspwm-logo.png)
+## Description
 
-## Synopsis
+*bspwm* is a tiling window manager that represents windows as the leaves of a full binary tree.
 
-    bspwm [-h|-v|-s PANEL_FIFO|-p PANEL_PREFIX]
+It only responds to X events, and the messages it receives on a dedicated socket.
 
-    bspc MESSAGE [ARGUMENTS] [OPTIONS]
+*bspc* is a program that writes messages on *bspwm*'s socket.
 
-## Description
+*bspwm* doesn't handle any keyboard or pointer inputs: a third party program (e.g. *sxhkd*) is needed in order to translate keyboard and pointer events to *bspc* invocations.
 
-`bspwm` is a tiling window manager that represents windows as the leaves of a full binary tree.
+The outlined architecture is the following:
 
-It is controlled and configured via `bspc`.
+```
+        PROCESS          SOCKET
+sxhkd  -------->  bspc  <------>  bspwm
+```
 
 ## Configuration
 
-`bspwm` have only two sources of informations: the X events it receives and the messages it reads on a dedicated socket.
+The default configuration file is `$XDG_CONFIG_HOME/bspwm/bspwmrc`: this is simply a shell script that calls *bspc*.
 
-Its configuration file is `$XDG_CONFIG_HOME/bspwm/autostart`.
+An argument is passed to that script to indicate whether is was executed after a restart (`$1 -gt 0`) or not (`$1 -eq 0`).
 
 Keyboard and pointer bindings are defined with [sxhkd](https://github.com/baskerville/sxhkd).
 
-Example configuration files can be found in the `examples` directory.
-
-## Splitting Modes
-
-There is only two splitting modes: *automatic* and *manual*.
-
-The default mode is *automatic*. The *manual* mode is entered by sending a *presel* message.
-
-Example: insertion of a new node (number 4) into the given tree in
-*automatic* mode:
-
-                     b                                   c
-                    / \                                 / \
-                   3   a              -->              4   b
-                   ^  / \                              ^  / \
-                     2   1                               3   a
-                                                            / \
-                                                           2   1
-        +-------------------------+         +-------------------------+
-        |            |            |         |            |            |
-        |            |     2      |         |            |     3      |
-        |            |            |         |            |            |
-        |     3      |------------|   -->   |     4      |------------|
-        |     ^      |            |         |     ^      |     |      |
-        |            |     1      |         |            |  1  |  2   |
-        |            |            |         |            |     |      |
-        +-------------------------+         +-------------------------+
-
-Same departure, but the mode is *manual*, and a `presel up` message
-was sent beforehand:
-
-                     b                                   b
-                    / \                                 / \
-                   3   a              -->              c   a
-                   ^  / \                             / \ / \
-                     2   1                           4  3 2  1
-                                                     ^
-        +-------------------------+         +-------------------------+
-        |            |            |         |            |            |
-        |            |     2      |         |     4      |     2      |
-        |            |            |         |     ^      |            |
-        |     3      |------------|   -->   |------------|------------|
-        |     ^      |            |         |            |            |
-        |            |     1      |         |     3      |     1      |
-        |            |            |         |            |            |
-        +-------------------------+         +-------------------------+
-
-## Containers
-
-Each monitor contains at least one desktop.
-
-Each desktop contains at most one tree.
-
-## Messages
-
-The syntax for the client is `bspc MESSAGE [ARGUMENTS ...]`.
-
-The following messages are handled:
-
-- `get SETTING` — Return the value of the given setting.
-
-- `set SETTING VALUE` — Set the value of the given setting.
-
-- `list [DESKTOP_NAME]` — Output the internal representation of the window tree.
-
-- `list_desktops [--quiet]` — Perform a dump of each desktop for the current monitor.
-
-- `list_monitors [--quiet]` — Perform a dump of each monitor.
-
-- `list_history` — Return the node focus history of each desktop.
-
-- `list_windows` — Return the list of managed windows (i.e. their identifiers).
-
-- `list_rules` — Return the list of rules.
-
-- `presel left|right|up|down [SPLIT_RATIO]` — Switch to manual mode and select the splitting direction.
-
-- `cancel` — Switch to automatic mode.
-
-- `ratio VALUE` — Set the splitting ratio of the focused window.
-
-- `pad MONITOR_NAME [TOP_PADDING [RIGHT_PADDING [BOTTOM_PADDING [LEFT_PADDING]]]]` — Set the padding of the given monitor.
-
-- `focus left|right|up|down` — Focus the neighbor window situated in the given direction.
-
-- `shift left|right|up|down` — Exchange the current window with the given neighbor.
-
-- `swap [--keep-focus]` — Swap the focused window with the last focused window.
-
-- `push left|right|up|down` — Push the fence located in the given direction.
-
-- `pull left|right|up|down` — Pull the fence located in the given direction.
-
-- `cycle next|prev [--skip-floating|--skip-tiled|--skip-class-equal|--skip-class-differ]` — Focus the next or previous window matching the given constraints.
-
-- `nearest older|newer [--skip-floating|--skip-tiled|--skip-class-equal|--skip-class-differ]` — Focus the nearest window matching the given constraints.
-
-- `biggest` — Return the ID of the biggest tiled window.
-
-- `circulate forward|backward` — Circulate the leaves in the given direction.
-
-- `grab_pointer focus|move|resize_side|resize_corner` — Begin the specified pointer action.
-
-- `track_pointer ROOT_X ROOT_Y` — Pass the pointer root coordinates for the current pointer action.
-
-- `ungrab_pointer` — End the current pointer action.
-
-- `toggle_fullscreen` — Toggle the fullscreen state of the current window.
-
-- `toggle_floating` — Toggle the floating state of the current window.
-
-- `toggle_locked` — Toggle the locked state of the current window (locked windows will not respond to the `close` message).
-
-- `toggle_visibility` — Toggle the visibility of all the managed windows.
-
-- `close` — Close the focused window.
-
-- `kill` — Kill the focused window.
-
-- `send_to DESKTOP_NAME [--follow]` — Send the focused window to the given desktop.
-
-- `drop_to next|prev [--follow]` — Send the focused window to the next or previous desktop.
-
-- `send_to_monitor MONITOR_NAME [--follow]` — Send the focused window to the given monitor.
-
-- `drop_to_monitor next|prev [--follow]` — Send the focused window to the next or previous monitor.
-
-- `use DESKTOP_NAME` — Select the given desktop.
-
-- `use_monitor MONITOR_NAME` — Select the given monitor.
-
-- `alternate` — Alternate between the current and the last focused window.
-
-- `alternate_desktop` — Alternate between the current and the last focused desktop.
-
-- `alternate_monitor` — Alternate between the current and the last focused monitor.
-
-- `add DESKTOP_NAME ...` — Make new desktops with the given names.
+Example configuration files can be found in the [examples](examples) directory.
 
-- `add_in MONITOR_NAME DESKTOP_NAME ...` — Make new desktops with the given names in the given monitor.
+## Monitors, desktops and windows
 
-- `rename_monitor CURRENT_NAME NEW_NAME` — Rename the monitor named `CURRENT_NAME` to `NEW_NAME`.
+*bspwm* holds a list of monitors.
 
-- `rename CURRENT_NAME NEW_NAME` — Rename the desktop named `CURRENT_NAME` to `NEW_NAME`.
+A monitor is just a rectangle that contains desktops.
 
-- `remove_desktop DESKTOP_NAME ...` — Remove the given desktops.
+A desktop is just a pointer to a tree.
 
-- `send_desktop_to MONITOR_NAME` — Send the current desktop to the given monitor.
+Monitors only show the tree of one desktop at a time (their focused desktop).
 
-- `cycle_monitor next|prev` — Select the next or previous monitor.
+The tree is a partition of a monitor's rectangle into smaller rectangular regions.
 
-- `cycle_desktop next|prev [--skip-free|--skip-occupied]` — Select the next or previous desktop.
+Each node in a tree either has zero or two children.
 
-- `layout monocle|tiled [DESKTOP_NAME ...]` — Set the layout of the given desktops (current if none given).
+Each internal node is responsible for splitting a rectangle in half.
 
-- `cycle_layout` — Cycle the layout of the current desktop.
+A split is defined by two parameters: the type (horizontal or vertical) and the ratio (a real number *r* such that *0 < r < 1*).
 
-- `rotate clockwise|counter_clockwise|full_cycle` — Rotate the window tree.
+Each leaf node holds exactly one window.
 
-- `flip horizontal|vertical` — Flip the window tree.
+## Insertion modes
 
-- `balance` — Adjust the split ratios so that all windows occupy the same area.
+When *bspwm* receives a new window, it inserts it into a window tree at the specified insertion point (a leaf) using the insertion mode specified for that insertion point.
 
-- `rule PATTERN [DESKTOP_NAME] [floating] [follow]` — Create a new rule (`PATTERN` must match the class or instance name).
+The insertion mode tells *bspwm* how it should alter the tree in order to insert new windows on a given insertion point.
 
-- `remove_rule UID ...` — Remove the rules with the given UIDs.
+By default the insertion point is the focused window and its insertion mode is *automatic*.
 
-- `put_status` — Output the current state to the panel fifo.
+### Manual mode
 
-- `adopt_orphans` — Manage all the unmanaged windows remaining from a previous session.
+The user can specify a region in the insertion point where the next new window should appear by sending a *node -p|--presel-dir DIR* message to *bspwm*.
 
-- `restore_layout FILE_PATH` — Restore the layout of each desktop from the content of `FILE_PATH`.
+The *DIR* argument allows to specify how the insertion point should be split (horizontally or vertically) and if the new window should be the first or the second child of the new internal node (the insertion point will become its *brother*).
 
-- `restore_history FILE_PATH` — Restore the history of each desktop from the content of `FILE_PATH`.
+After doing so the insertion point goes into *manual* mode.
 
-- `quit [EXIT_STATUS]` — Quit.
+Let's consider the following scenario:
 
-## Settings
+```
+            a                          a                          a
+           / \                        / \                        / \
+          1   b         --->         c   b         --->         c   b
+          ^  / \                    / \ / \                    / \ / \
+            2   3                  4  1 2  3                  d  1 2  3
+                                   ^                         / \
+                                                            5   4
+                                                            ^
 
-Colors are either [X color names](http://en.wikipedia.org/wiki/X11_color_names) or *#RRGGBB*, booleans are *true* or *false*.
++-----------------------+  +-----------------------+  +-----------------------+
+|           |           |  |           |           |  |     |     |           |
+|           |     2     |  |     4     |     2     |  |  5  |  4  |     2     |
+|           |           |  |     ^     |           |  |  ^  |     |           |
+|     1     |-----------|  |-----------|-----------|  |-----------|-----------|
+|     ^     |           |  |           |           |  |           |           |
+|           |     3     |  |     1     |     3     |  |     1     |     3     |
+|           |           |  |           |           |  |           |           |
++-----------------------+  +-----------------------+  +-----------------------+
 
-- `focused_border_color` — Color of the border of a focused window of a focused monitor.
+            X                          Y                          Z 
+```
 
-- `active_border_color` — Color of the border of a focused window of an unfocused monitor.
+In state *X*, the insertion point is *1*.
 
-- `normal_border_color` — Color of the border of an unfocused window.
+We send the following message to *bspwm*: *node -p north*.
 
-- `presel_border_color` — Color of the `presel` message feedback.
+Then add a new window: *4*, this leads to state *Y*: the new internal node, *c* becomes *a*'s first child.
 
-- `focused_locked_border_color` — Color of the border of a focused locked window of a focused monitor.
+Finally we send another message: *node -p west* and add window *5*.
 
-- `active_locked_border_color` — Color of the border of a focused locked window of an unfocused monitor.
+The ratio of the preselection (that ends up being the ratio of the split of the new internal node) can be changed with the *node -o|--presel-ratio* message.
 
-- `normal_locked_border_color` — Color of the border of an unfocused locked window.
+### Automatic mode
 
-- `urgent_border_color` — Color of the border of an urgent window.
+The *automatic* mode, as opposed to the *manual* mode, doesn't require any user choice. The way the new window is inserted is determined by the value of the automatic scheme and the initial polarity settings.
 
-- `border_width` — Window border width.
+#### Longest side scheme
 
-- `window_gap` — Value of the gap that separates windows.
+When the value of the automatic scheme is `longest_side`, the window will be attached as if the insertion point was in manual mode and the split direction was chosen based on the dimensions of the tiling rectangle and the initial polarity.
 
-- `split_ratio` — Default split ratio.
+Let's consider the following scenario, where the initial polarity is set to `second_child`:
 
-- `{top,right,bottom,left}_padding` — Padding space added at the sides of the current monitor.
+```
+             1                          a                          a
+             ^                         / \                        / \
+                         --->         1   2         --->         1   b
+                                          ^                         / \
+                                                                   2   3
+                                                                       ^
 
-- `wm_name` — The value that shall be used for the `_NET_WM_NAME` property of the root window.
+ +-----------------------+  +-----------------------+  +-----------------------+
+ |                       |  |           |           |  |           |           |
+ |                       |  |           |           |  |           |     2     |
+ |                       |  |           |           |  |           |           |
+ |           1           |  |     1     |     2     |  |     1     |-----------|
+ |           ^           |  |           |     ^     |  |           |           |
+ |                       |  |           |           |  |           |     3     |
+ |                       |  |           |           |  |           |     ^     |
+ +-----------------------+  +-----------------------+  +-----------------------+
 
-- `borderless_monocle` — Whether to remove borders for tiled windows in monocle mode.
+             X                          Y                          Z
+```
 
-- `gapless_monocle` — Whether to remove gaps for tiled windows in monocle mode.
+In state *X*, a new window is added.
 
-- `focus_follows_pointer` — Whether to focus the window under the pointer.
+Since *1* is wide, it gets split vertically and *2* is added as *a*'s second child given the initial polarity.
 
-- `adaptative_raise` — Prevent floating windows from being raised when they might cover other floating windows.
+This leads to *Y* where we insert window *3*. *2* is tall and is therefore split horizontally. *3* is once again added as *b*'s second child.
 
-- `apply_shadow_property` — Enable shadows for floating windows via the `_COMPTON_SHADOW` property.
+#### Alternate scheme
 
-- `auto_alternate` — Whether to interpret two consecutive identical `use` messages as an `alternate` message.
+When the value of the automatic scheme is `alternate`, the window will be attached as if the insertion point was in manual mode and the split direction was chosen based on the split type of the insertion point's parent and the initial polarity. If the parent is split horizontally, the insertion point will be split vertically and vice versa.
 
-- `focus_by_distance` — Whether to use window or leaf distance for focus movement.
+#### Spiral scheme
 
-## Environment Variables
+When the value of the automatic scheme is `spiral`, the window will *take the space* of the insertion point.
 
-- `BSPWM_SOCKET` — The path of the socket used for the communication between `bspc` and `bspwm`.
+Let's dive into the details with the following scenario:
 
-## Key Features
+```
+             a                          a                          a
+            / \                        / \                        / \
+           1   b         --->         1   c         --->         1   d
+              / \                        / \                        / \
+             2   3                      4   b                      5   c
+             ^                          ^  / \                     ^  / \
+                                          3   2                      b   4
+                                                                    / \
+                                                                   3   2
 
-- Configured and controlled through messages.
-- Multiple monitors support (via *RandR*).
-- EWMH support (`tint2` works).
-- Automatic and manual modes.
+ +-----------------------+  +-----------------------+  +-----------------------+
+ |           |           |  |           |           |  |           |           |
+ |           |     2     |  |           |     4     |  |           |     5     |
+ |           |     ^     |  |           |     ^     |  |           |     ^     |
+ |     1     |-----------|  |     1     |-----------|  |     1     |-----------|
+ |           |           |  |           |     |     |  |           |  3  |     |
+ |           |     3     |  |           |  3  |  2  |  |           |-----|  4  |
+ |           |           |  |           |     |     |  |           |  2  |     |
+ +-----------------------+  +-----------------------+  +-----------------------+
 
-## Panels
+             X                          Y                          Z
+```
 
-- Any EWMH compliant panel (e.g.: `tint2`, `bmpanel2`, etc.).
-- A custom panel if the `-s` flag is used (have a look at the files in `examples/panel`).
+In state *X*, the insertion point, *2* is in automatic mode.
 
-## Required Libraries:
+When we add a new window, *4*, the whole tree rooted at *b* is reattached, as the second child of a new internal node, *c*.
 
-- libxcb
-- xcb-util
-- xcb-util-wm
+The splitting parameters of *b* (type: *horizontal*, ratio: *½*) are copied to *c* and *b* is rotated by 90° clockwise.
 
-## Installation
+The tiling rectangle of *4* in state *Y* is equal to the tiling rectangle of *2* in state *X*.
 
-    make
-    make install
+Then the insertion of *5*, with *4* as insertion point, leads to *Z*.
 
-## Contributors
+The *spiral* automatic scheme generates window spirals that rotate clockwise (resp. anti-clockwise) if the insertion point is the first (resp. second) child of its parent.
 
-- [Ivan Kanakarakis](https://github.com/c00kiemon5ter)
 
-- [Thomas Adam](https://github.com/ThomasAdam)
+## Supported protocols and standards
 
-## Mailing List
+- The RandR and Xinerama protocols.
+- A subset of the EWMH and ICCCM standards.
 
-bspwm *at* librelist *dot* com.
+## Community
 
-## License
+Want to get in touch with other *bspwm* users or you need help? Join us on our:
 
-BSD.
+- Subreddit at [r/bspwm](https://www.reddit.com/r/bspwm/).
+- IRC channel at `#bspwm` on `irc.libera.chat` (maintained by [@dannycolin](https://github.com/dannycolin) / sdk on IRC).
+- Matrix room at https://matrix.to/#/#bspwm:matrix.org