]> git.lizzy.rs Git - bspwm.git/blobdiff - README.md
Merge pull request #317 from guyhughes/fix-doc
[bspwm.git] / README.md
index d1bb23ceede79939d44f77875f3bd2f25bad90a5..59537d1233bf259b3aff6536e1d31b9edb011b76 100644 (file)
--- a/README.md
+++ b/README.md
-![logo](https://github.com/baskerville/bspwm/raw/master/resources/bspwm_logo.png)
-
 ## Description
 
-`bspwm` is a tiling window manager based on binary space partitioning.
-
-The windows are represented as the leaves of a binary tree.
-
-## Configuration
-
-`bspwm` have only two sources of informations: the X events it receives and the messages it reads on a dedicated socket.
-
-Those messages are sent through the `bspc` program.
-
-If the `BSPWM_SOCKET` environment variable is defined, it will be used as the socket path, otherwise `/tmp/bspwm-socket` is used.
-
-The recommended way of defining keyboard shortcuts is to use `xbindkeys`.
-
-The only way to configure `bspwm` is by sending *set* messages via the client, hence `bspwm`'s configuration file is an executable called `autostart` which lives in `$XDG_CONFIG_HOME/bspwm/`.
-
-Example configurations: [autostart](https://github.com/baskerville/bin/blob/master/bspwm_autostart) and [xbindkeysrc](https://github.com/baskerville/dotfiles/blob/master/xbindkeysrc).
-
-## 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*, 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      |
-        |            |            |         |            |            |
-        +-------------------------+         +-------------------------+
-
-## Messages
+*bspwm* is a tiling window manager that represents windows as the leaves of a full binary tree.
 
-The syntax for the client is `bspc COMMAND ARGUMENTS...`.
+It only responds to X events, and the messages it receives on a dedicated socket.
 
-The following messages are handled:
+*bspc* is a program that writes messages on *bspwm*'s socket.
 
-    quit
-        Quit.
+*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.
 
-    get SETTING
-        Return the value of the given setting.
+The outlined architecture is the following:
 
-    set SETTING VALUE
-        Set the value of the given setting.
+```
+        PROCESS          SOCKET
+sxhkd  -------->  bspc  <------>  bspwm
+```
 
-    dump
-        Output the internal representation of the window tree.
-
-    list_monitors [--quiet]
-        Perform a dump of each monitor.
-
-    list [--quiet]
-        Perform a dump of each desktop for the current monitor.
-
-    windows
-        Return the list of managed windows (i.e. their identifiers).
-
-    close
-        Close the focused window.
-
-    kill
-        Kill the focused window.
-
-    presel DIR
-        Switch to manual mode and select the splitting direction.
-
-    ratio VALUE
-        Set the splitting ratio of the focused window.
-
-    cancel
-        Switch to automatic mode.
-
-    focus DIR
-        Focus the neighbor node situated in the given direction. 
-
-    shift DIR
-        Focus the neighbor node situated in the given direction. 
-
-    push DIR
-        Push the fence located in the given direction.
-
-    pull DIR
-        Pull the fence located in the given direction.
-
-    cycle CYC [--skip-floating|--skip-tiled|--skip-class-equal|--skip-class-differ]
-        Focus the next or previous window in the list of leaves.
-
-    rotate ROT
-        Rotate the tree of the current desktop.
-
-    magnetise COR
-        Move all the fences toward the given corner.
-
-    send_to DESKTOP_NAME
-        Send the focused window to the given desktop.
+## Configuration
 
-    use_monitor MONITOR_NAME
-        Select the given monitor.
+The default configuration file is `$XDG_CONFIG_HOME/bspwm/bspwmrc`: this is simply a shell script that calls *bspc*.
 
-    use DESKTOP_NAME
-        Select the given desktop.
-    
-    alternate_monitor
-        Alternate between the current and the last focused monitor.
+Keyboard and pointer bindings are defined with [sxhkd](https://github.com/baskerville/sxhkd).
 
-    alternate
-        Alternate between the current and the last focused desktop.
+Example configuration files can be found in the [examples](examples) directory.
 
-    add DESKTOP_NAME
-        Make a new desktop with the given name.
+## 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.
 
-    cycle_monitor CYC
-        Select the next or previous monitor.
+A desktop is just a pointer to a tree.
 
-    cycle_desktop CYC
-        Select the next or previous desktop.
-        
-    layout LYT
-        Set the layout of the current desktop to LYT.
+Monitors only show the tree of one desktop at a time (their focused desktop).
 
-    cycle_layout
-        Cycle the layout of the current desktop.
+The tree is a partition of a monitor's rectangle into smaller rectangular regions.
 
-    toggle_fullscreen
-        Toggle the fullscreen state of the current window.
+Each node in a tree either has zero or two children.
 
-    toggle_floating
-        Toggle the floating state of the current window.
+Each internal node is responsible for splitting a rectangle in half.
 
-    toggle_locked
-        Toggle the locked state of the current window (locked windows will not respond to the 'close' command).
+A split is defined by two parameters: the type (horizontal or vertical) and the ratio (a real number *r* such that *0 < r < 1*).
 
-    rule PATTERN floating 
-        Make a new rule that will float the windows whose class name or instance name equals PATTERN. 
+Each leaf node holds exactly one window.
 
-    reload_autostart
-        Reload the autostart file.
+## Insertion Modes
 
-    reload_settings
-        Reload the default settings.
+### Prelude
 
-    reload
-        Reload the autostart file and the default settings.
+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.
 
-Where
+The insertion mode tells *bspwm* how it should alter the tree in order to insert new windows on a given insertion point.
 
-    DIR = left|right|up|down
-    CYC = next|prev
-    ROT = clockwise|counter_clockwise|full_cycle
-    COR = top_left|top_right|bottom_left|bottom_right
-    LYT = monocle|tiled
+By default the insertion point is the focused window and its default insertion mode is *automatic*.
 
-## Settings
+### Automatic Mode
 
-Colors are either [X color names](http://en.wikipedia.org/wiki/X11_color_names) or '#RRGGBB', booleans are 'true' or 'false'.
+The *automatic* mode, as opposed to the *manual* mode, doesn't require any user choice: the new window will *take the space* of the insertion point.
 
-    focused_border_color
-        Color of the main border of a focused window of a focused monitor.
+For example, let's consider the following scenario:
 
-    active_border_color
-        Color of the main border of a focused window of an unfocused monitor.
+```
+             a                          a                          a
+            / \                        / \                        / \
+           1   b         --->         1   c         --->         1   d
+              / \                        / \                        / \
+             2   3                      4   b                      5   c
+             ^                          ^  / \                     ^  / \
+                                          3   2                      b   4
+                                                                    / \ 
+                                                                   3   2
 
-    normal_border_color
-        Color of the main border of an unfocused window.
-    
-    inner_border_color
-        Color of the inner border of a window.
+ +-----------------------+  +-----------------------+  +-----------------------+
+ |           |           |  |           |           |  |           |           |
+ |           |     2     |  |           |     4     |  |           |     5     |
+ |           |     ^     |  |           |     ^     |  |           |     ^     |
+ |     1     |-----------|  |     1     |-----------|  |     1     |-----------|
+ |           |           |  |           |     |     |  |           |  3  |     |
+ |           |     3     |  |           |  3  |  2  |  |           |-----|  4  |
+ |           |           |  |           |     |     |  |           |  2  |     |
+ +-----------------------+  +-----------------------+  +-----------------------+
 
-    outer_border_color
-        Color of the outer border of a window.
-    
-    presel_border_color
-        Color of the *presel* message feedback.
+              X                         Y                          Z 
+```
 
-    focused_locked_border_color
-        Color of the main border of a focused locked window of a focused monitor.
+In state *X*, the insertion point, *2* is in automatic mode.
 
-    active_locked_border_color
-        Color of the main border of a focused locked window of an unfocused monitor.
+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*.
 
-    normal_locked_border_color
-        Color of the main border of an unfocused locked window.
+The splitting parameters of *b* (type: *horizontal*, ratio: *½*) are copied to *c* and *b* is rotated by 90° clockwise.
 
-    urgent_border_color
-        Color of the border of an urgent window.
+The tiling rectangle of *4* in state *Y* is equal to the tiling rectangle of *2* in state *X*.
 
-    inner_border_width
-    main_border_width
-    outer_border_width
-        Width of the inner, main and outer borders.
+Then the insertion of *5*, with *4* as insertion point, leads to *Z*.
 
-    window_gap
-        Value of the gap that separates windows.
+The automatic mode generates window spirals that rotate clockwise (resp. anti-clockwise) if the insertion point is the first (resp. second) child of its parent.
 
-    top_padding
-    bottom_padding
-    left_padding
-    right_padding
-        Padding space added at the sides of the screen.
+### Manual Mode
 
-    wm_name
-        The value that shall be used for the _NET_WM_NAME property of the root window.
+The user can specify a region in the insertion point where the next new window should appear by sending a *window --presel DIR* message to *bspwm*.
 
-    borderless_monocle 
-        Whether to remove borders for tiled windows in monocle mode.
+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*).
 
-## Mouse Bindings
+After doing so the insertion point goes into *manual* mode.
 
-    M4 + Left Button
-        Move the window under the pointer.
+For example, let's consider the following scenario:
 
-    M4 + Middle Button
-        Focus the window under the pointer.
+```
+            a                          a                          a
+           / \                        / \                        / \
+          1   b         --->         c   b         --->         c   b
+          ^  / \                    / \ / \                    / \ / \
+            2   3                  4  1 2  3                  d  1 2  3
+                                   ^                         / \
+                                                            5   4
+                                                            ^
 
-    M4 + Middle Button
-        Resize the window under the pointer (by moving one of its four corners).
++-----------------------+  +-----------------------+  +-----------------------+
+|           |           |  |           |           |  |     |     |           |
+|           |     2     |  |     4     |     2     |  |  5  |  4  |     2     |
+|           |           |  |     ^     |           |  |  ^  |     |           |
+|     1     |-----------|  |-----------|-----------|  |-----------|-----------|
+|     ^     |           |  |           |           |  |           |           |
+|           |     3     |  |     1     |     3     |  |     1     |     3     |
+|           |           |  |           |           |  |           |           |
++-----------------------+  +-----------------------+  +-----------------------+
 
-Where *M4* is the fourth modifier mask (generally bound to *Super*).
+            X                          Y                          Z 
+```
 
-## Panel
+In state *X*, the insertion point is *1*.
 
-`dzen2` fed with the output of `ewmhstatus`. Example: [launchpanel](https://github.com/baskerville/bin/blob/master/launchpanel).
+We send the following message to *bspwm*: *window --presel up*.
 
-## Required Libraries:
+Then add a new window: *4*, this leads to state *Y*: the new internal node, *c* becomes *a*'s first child.
 
-libxcb, xcb-util, xcb-util-wm.
+Finally we send another message: *window --presel left* and add window *5*.
 
-## Installation
+The ratio of the preselection (that ends up being the ratio of the split of the new internal node) can be change with the *window --ratio* message.
 
-    make
-    make install
+## Supported protocols and standards
 
+- The RandR and Xinerama protocols.
+- A subset of the EWMH and ICCCM standards.