Difference between revisions of "Bspwm"

From ArchWiki
Jump to: navigation, search
(Panels)
(27 intermediate revisions by 9 users not shown)
Line 1: Line 1:
= Synopsis =
+
[[Category:Tiling WMs]]
 +
'''bspwm''' is a tiling window manager that represents windows as the leaves of a full binary tree. It has support for [http://standards.freedesktop.org/wm-spec/wm-spec-1.3.html EWMH] and multiple monitors, and is configured and controlled through messages.
  
'''bspwm''' ['''-h'''|'''-v'''|'''-s''' ''PANEL_FIFO''|'''-p''' ''PANEL_PREFIX'']
+
== Installation ==
  
'''bspc''' ''MESSAGE'' [''ARGUMENTS''] [''OPTIONS'']
+
Install {{AUR|bspwm}} or {{AUR|bspwm-git}} from the [[AUR]]. You will also want to install {{AUR|sxhkd}} or {{AUR|sxhkd-git}}, a simple X hotkey daemon used to communicate with bspwm through {{ic|bspc}} as well as launch your applications of choice. With commit {{ic | 948b804}}, {{AUR | xwinfo-git}} is also required by the example configuration files.
  
= Description =
+
To start bspwm on login, add the following to your {{ic|.xinitrc}}:
  
'''bspwm''' is a tiling window manager that represents windows as the leaves of a full binary tree.
+
{{bc|
 +
sxhkd &
 +
exec bspwm
 +
}}
  
It is controlled and configured via '''bspc'''.
+
== Configuration ==
  
= Configuration =
+
Example configuration is found on [https://github.com/baskerville/bspwm/blob/master/examples/ GitHub].
  
'''bspwm''' have only two sources of informations: the X events it receives and the messages it reads on a dedicated socket.
+
Copy [https://github.com/baskerville/bspwm/blob/master/examples/bspwmrc bspwmrc] to {{ic|~/.config/bspwm/bspwmrc}}, [https://github.com/baskerville/bspwm/blob/master/examples/sxhkdrc sxhkdrc] to {{ic|~/.config/sxhkd/sxhkdrc}} and make bspwmrc executable with {{ic|chmod +x ~/.config/bspwm/bspwmrc}}.
  
Its configuration file is ''$XDG_CONFIG_HOME/bspwm/autostart''.
+
Documentation for bspwm is found by running {{ic|man bspwm}}.
  
Keyboard and pointer bindings are defined with [https://github.com/baskerville/sxhkd sxhkd].
+
There is also documentation for sxhkd found by running {{ic|man sxhkd}}.
  
Example configuration files can be found in the '''examples''' directory.
+
These two files are where you will be setting wm settings and keybindings, respectively.
  
= Splitting Modes =
+
=== Rules ===
  
There is only two splitting modes: ''automatic'' and ''manual''.
+
As of {{ic|948b804}} window-specific rules were externalized.
 +
Rules can be created in a few different ways. Two such methods are below:
  
The default mode is ''automatic''. The ''manual'' mode is entered by sending a '''presel''' message.
+
# Using the example scripts provide in [https://github.com/baskerville/bspwm/blob/master/contrib/rules rules], place {{ic | rulc}} and {{ic | ruld}} in a folder that is in your $PATH and make them executable. Start {{ ic | ruld }} on login with something like {{ ic | rulc -l > /dev/null <nowiki>||</nowiki> ruld &}}. You can then use the rules in the example {{ic | bspwmrc }} These scripts require both [https://www.archlinux.org/packages/?sort=&q=lua-posix&maintainer=&flagged= lua-posix] and [https://www.archlinux.org/packages/?sort=&repo=Extra&q=lua&maintainer=&flagged= lua]
 +
# Alternatively, create a script that is called in your bspwmrc file that forms the rules. See [https://bbs.archlinux.org/viewtopic.php?pid=1346272#p1346272 Stebalien's post] or [https://gist.github.com/windelicato/7348087 earsplit's config] for examples of how to accomplish this.
  
Example: insertion of a new node (number 4) into the given tree in ''automatic'' mode:
+
Both of these methods require installing '''xwinfo''' from the [https://aur.archlinux.org/packages/xwinfo-git AUR] or from  [https://github.com/baskerville/xwinfo github]
  
<pre>             b                                  c
+
If a particular window does not seem to be behaving according to your rules, check the class name of the program. This can be accomplished by running {{ ic | xprop <nowiki>|</nowiki> grep WM_CLASS}} to make sure you're using the proper string.
            / \                                / \
+
            3  a              --&gt;              4  b
+
            ^  / \                              ^  / \
+
              2  1                              3  a
+
                                                    / \
+
                                                    2  1
+
+-------------------------+        +-------------------------+
+
|            |            |        |            |            |
+
|            |    2      |        |            |    3      |
+
|            |            |        |            |            |
+
|    3      |------------|  --&gt;  |    4      |------------|
+
|    ^      |            |        |    ^      |    |      |
+
|            |    1      |        |            |  1  |  2  |
+
|            |            |        |            |    |      |
+
+-------------------------+        +-------------------------+</pre>
+
Same departure, but the mode is ''manual'', and a '''presel''' ''up'' message was sent beforehand:
+
  
<pre>            b                                  b
+
=== Panels ===
            / \                                / \
+
Currently, [https://aur.archlinux.org/packages/bar-aint-recursive/ bar] and [https://www.archlinux.org/packages/?sort=&q=dzen2&maintainer=&flagged= dzen2] are supported with bspwm. Check the examples folder on the GitHub page for ideas or the [https://wiki.archlinux.org/index.php/Bar-aint-recursive Bar] wiki page. The panel will be executed by placing {{ic | panel &}} for bar or {{ic | panel dzen2 &}} for dzen2 in your bspwmrc. Check the opt-depends in the bspwm package for dependencies that may be required in either case.
          3  a              --&gt;              c  a
+
          ^  / \                            / \ / \
+
            2  1                          4  3 2  1
+
                                            ^
+
+-------------------------+        +-------------------------+
+
|           |           |        |            |            |
+
|            |    2      |        |    4      |    2      |
+
|            |            |        |    ^      |            |
+
|    3      |------------|  --&gt;  |------------|------------|
+
|    ^      |            |        |            |            |
+
|            |    1      |        |    3      |    1      |
+
|            |            |        |            |            |
+
+-------------------------+        +-------------------------+</pre>
+
= Containers =
+
  
Each monitor contains at least one desktop.
+
To display system information on your status bar you can use various system calls. This example will show you how to edit your {{ic | panel }} to get the volume status on your BAR:
  
Each desktop contains at most one tree.
+
{{bc|<nowiki>
 +
panel_volume()
 +
{
 +
        volStatus=$(amixer get Master | tail -n 1 | cut -d '[' -f 4 | sed 's/].*//g')
 +
        volLevel=$(amixer get Master | tail -n 1 | cut -d '[' -f 2 | sed 's/%.*//g')
 +
        # is alsa muted or not muted?
 +
        if [ "$volStatus" == "on" ]
 +
        then
 +
                echo "\f6"$volLevel
 +
        else
 +
                # If it is muted, make the font red
 +
                echo "\f1"$volLevel
 +
        fi
 +
}</nowiki>}}
  
= Messages =
+
Next, we will have to make sure it is called and piped to {{ic | $PANEL_FIFO}}:
  
; '''get''' ''SETTING''
+
{{bc|<nowiki>
: Return the value of the given setting.
+
while true; do
; '''set''' ''SETTING'' ''VALUE''
+
echo "S" "$(panel_volume) $(panel_clock) > "$PANEL_FIFO"
: Set the value of the given setting.
+
        sleep 1s
; '''list''' [''DESKTOP_NAME'']
+
done &
: Output the internal representation of the window tree.
+
</nowiki>}}
; '''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.
+
; '''fence_ratio''' ''left''|''right''|''up''|''down''
+
: Set the splitting ratio of 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.
+
; '''add_in''' ''MONITOR_NAME'' ''DESKTOP_NAME'' ...
+
: Make new desktops with the given names in the given monitor.
+
; '''rename_monitor''' ''CURRENT_NAME'' ''NEW_NAME''
+
: Rename the monitor named ''CURRENT_NAME'' to ''NEW_NAME''.
+
; '''rename''' ''CURRENT_NAME'' ''NEW_NAME''
+
: Rename the desktop named ''CURRENT_NAME'' to ''NEW_NAME''.
+
; '''remove_desktop''' ''DESKTOP_NAME'' ...
+
: Remove the given desktops.
+
; '''send_desktop_to''' ''MONITOR_NAME'' ['''--follow''']
+
: Send the current desktop to the given monitor.
+
; '''cycle_monitor''' ''next''|''prev''
+
: Select the next or previous monitor.
+
; '''cycle_desktop''' ''next''|''prev'' ['''--skip-free'''|'''--skip-occupied''']
+
: Select the next or previous desktop.
+
; '''layout''' ''monocle''|''tiled'' [''DESKTOP_NAME'' ...]
+
: Set the layout of the given desktops (current if none given).
+
; '''cycle_layout'''
+
: Cycle the layout of the current desktop.
+
; '''rotate''' ''clockwise''|''counter_clockwise''|''full_cycle''
+
: Rotate the window tree.
+
; '''flip''' ''horizontal''|''vertical''
+
: Flip the window tree.
+
; '''balance'''
+
: Adjust the split ratios so that all windows occupy the same area.
+
; '''rule''' ''PATTERN'' [''DESKTOP_NAME''] [''floating''] [''follow'']
+
: Create a new rule (''PATTERN'' must match the class or instance name).
+
; '''remove_rule''' ''UID'' ...
+
: Remove the rules with the given ''UID''s.
+
; '''put_status'''
+
: Output the current state to the panel fifo.
+
; '''adopt_orphans'''
+
: Manage all the unmanaged windows remaining from a previous session.
+
; '''restore_layout''' ''FILE_PATH''
+
: Restore the layout of each desktop from the content of ''FILE_PATH''.
+
; '''restore_history''' ''FILE_PATH''
+
: Restore the history of each desktop from the content of ''FILE_PATH''.
+
; '''quit''' [''EXIT_STATUS'']
+
: Quit.
+
  
= Settings =
+
== Example how to configure after install ==
 +
{{warning | This not yet a finished guide}}
 +
{{warning | Please note that bspwm are under heavy development and can change a lot. This is how I did last time. If something is wrong please correct the faults of it.}}
  
Colors are either [http://en.wikipedia.org/wiki/X11_color_names X color names] or ''#RRGGBB'', booleans are ''true'' or ''false''.
 
  
All the boolean settings are ''false'' by default.
+
:1. Copy the supplied '''bspwm_rules''', '''rule_command''', '''ruld''' and '''rulc''' scripts from [https://github.com/baskerville/bspwm/tree/master/examples/external_rules Examples] to {{ic | $XDG_CONFIG_HOME/bspwm/}} and ensure they are executable.  
  
; ''focused_border_color''
+
:2. Edit {{ic | $HOME/.profile}} to something similar to this:
: Color of the border of a focused window of a focused monitor.
+
{{bc|<nowiki>PATH="/usr/games:$HOME/.config/bspwm:$PATH"
; ''active_border_color''
+
: Color of the border of a focused window of an unfocused monitor.
+
; ''normal_border_color''
+
: Color of the border of an unfocused window.
+
; ''presel_border_color''
+
: Color of the '''presel''' message feedback.
+
; ''focused_locked_border_color''
+
: Color of the border of a focused locked window of a focused monitor.
+
; ''active_locked_border_color''
+
: Color of the border of a focused locked window of an unfocused monitor.
+
; ''normal_locked_border_color''
+
: Color of the border of an unfocused locked window.
+
; ''urgent_border_color''
+
: Color of the border of an urgent window.
+
; ''border_width''
+
: Window border width.
+
; ''window_gap''
+
: Value of the gap that separates windows.
+
; ''split_ratio''
+
: Default split ratio.
+
; ''top_padding'', ''right_padding'', ''bottom_padding'', ''left_padding''
+
: Padding space added at the sides of the current monitor.
+
; ''wm_name''
+
: The value that shall be used for the ''_NET_WM_NAME'' property of the root window.
+
; ''borderless_monocle''
+
: Remove borders for tiled windows in monocle mode.
+
; ''gapless_monocle''
+
: Remove gaps for tiled windows in monocle mode.
+
; ''focus_follows_pointer''
+
: Focus the window under the pointer.
+
; ''pointer_follows_monitor''
+
: When focusing a monitor, put the pointer at its center.
+
; ''adaptative_raise''
+
: Prevent floating windows from being raised when they might cover other floating windows.
+
; ''apply_shadow_property''
+
: Enable shadows for floating windows via the ''_COMPTON_SHADOW'' property.
+
; ''auto_alternate''
+
: Interpret two consecutive identical '''use''' messages as an '''alternate''' message.
+
; ''focus_by_distance''
+
: Use window or leaf distance for focus movement.
+
; ''history_aware_focus''
+
: Give priority to the focus history when focusing nodes.
+
  
= Environment Variables =
+
export XDG_CONFIG_HOME="/home/$USER/.config"
  
; ''BSPWM_SOCKET''
+
## Bspwm
: The path of the socket used for the communication between '''bspc''' and '''bspwm'''.
+
export BSPWM_SOCKET="/tmp/bspwm-socket"
 +
export BSPWM_TREE=/tmp/bspwm.tree
 +
export BSPWM_HISTORY=/tmp/bspwm.history
 +
export BSPWM_STACK=/tmp/bspwm.stack
 +
export PANEL_FIFO=/tmp/panel-fifo
 +
export PANEL_HEIGHT=14</nowiki>}}
  
= Panels =
+
:3. Edit {{ic | $HOME/.xinitrc }} and add.
 +
source $HOME/.profile &
 +
sxhkd -c $XDG_CONFIG_HOME/bspwm/sxhkdrc &
 +
exec wm
  
* Any EWMH compliant panel (e.g.: ''tint2'', ''bmpanel2'', etc.).
+
:4. Add this line to {{ic|$XDG_CONFIG_HOME/bspwm/bspwmrc}}.
* A custom panel if the ''-s'' flag is used (have a look at the files in ''examples/panel'').
+
{{ic|bspc config rule_command "$(command -v rule_command)"}}
  
= Key Features =
+
:5. Install [https://aur.archlinux.org/packages/xwinfo-git/ xwinfo] from [https://aur.archlinux.org/packages/xwinfo-git AUR] and [https://www.archlinux.org/packages/?sort=&q=lua-posix lua-posix]. Change the rules of {{ic|$XDG_CONFIG_HOME/bspwm/bspwm_rules}} to your likening.
 +
{{hc|$ man bspc|
 +
...
 +
rule_command
 +
External command used to retrieve rule consequences. The command will receive the the ID of the
 +
window being processed as its first argument. The output of that command must have the following
 +
format: <nowiki>key1=value1 key2=value2</nowiki> ..., where keyN is one of floating, fullscreen, locked, sticky,
 +
private, frame, center, lower, follow, manage, focus, desktop or monitor.
 +
...}}
  
* Configured and controlled through messages.
+
:To find out the window names you can use [https://www.archlinux.org/packages/?sort=&q=xorg-xprop xorg-xprop]. The lower-case 'vlc' is the instance and the upper-case 'Vlc' is the class.
* Multiple monitors support (via ''RandR'').
+
{{hc|<nowiki>$ xprop | grep WM_CLASS</nowiki>|<nowiki>WM_CLASS(STRING) = "vlc", "Vlc"</nowiki>}}
* EWMH support ('''tint2''' works).
+
* Automatic and manual modes.
+
  
= Mailing List =
+
:6. Restart bspwm and check so the rules have been applied.
 +
{{hc|$ rulc -l|
 +
class <nowiki>== "Gimp" =>floating=on</nowiki>
 +
class <nowiki>== "Firefox" => desktop=^2</nowiki>
 +
class <nowiki>== "Vlc" => desktop=^3</nowiki>
 +
instance <nowiki>== "rtorrent" => desktop=^3</nowiki>
 +
instance <nowiki>== "URthree" => desktop=^3</nowiki>}}
  
bspwm at librelist.com
+
== Troubleshooting ==
 +
 
 +
The following environmental variables may need to be defined:
 +
{{bc|
 +
echo $BSPWM_SOCKET
 +
echo $XDG_CONFIG_HOME
 +
}}
 +
 
 +
If either of these do not respond with a value, then go to your ''~/.profile'' and add the following lines:
 +
{{bc|
 +
export XDG_CONFIG_HOME&#61;"$HOME/.config"
 +
export BSPWM_SOCKET&#61;"/tmp/bspwm-socket"
 +
}}
 +
{{Note|You may put these anywhere that is sourced for your user.  Another sane place to put these would be as part of your user's ~/.xinitrc, or zsh users might choose ~/.zshenv.  User your best discretion.}}
 +
 
 +
== See also ==
 +
 
 +
* Mailing List: bspwm ''at'' librelist.com.
 +
* {{ic|#bspwm}} - IRC channel at the irc.freenode.net
 +
* https://bbs.archlinux.org/viewtopic.php?id=149444 - Arch BBS thread
 +
* https://github.com/baskerville/bspwm - GitHub project
 +
* https://github.com/windelicato/dotfiles/wiki/bspwm-for-dummies - earsplit's "bspwm for dummies"

Revision as of 00:25, 26 November 2013

bspwm is a tiling window manager that represents windows as the leaves of a full binary tree. It has support for EWMH and multiple monitors, and is configured and controlled through messages.

Installation

Install bspwmAUR or bspwm-gitAUR from the AUR. You will also want to install sxhkdAUR or sxhkd-gitAUR, a simple X hotkey daemon used to communicate with bspwm through bspc as well as launch your applications of choice. With commit 948b804, xwinfo-gitAUR is also required by the example configuration files.

To start bspwm on login, add the following to your .xinitrc:

sxhkd &
exec bspwm

Configuration

Example configuration is found on GitHub.

Copy bspwmrc to ~/.config/bspwm/bspwmrc, sxhkdrc to ~/.config/sxhkd/sxhkdrc and make bspwmrc executable with chmod +x ~/.config/bspwm/bspwmrc.

Documentation for bspwm is found by running man bspwm.

There is also documentation for sxhkd found by running man sxhkd.

These two files are where you will be setting wm settings and keybindings, respectively.

Rules

As of 948b804 window-specific rules were externalized. Rules can be created in a few different ways. Two such methods are below:

  1. Using the example scripts provide in rules, place rulc and ruld in a folder that is in your $PATH and make them executable. Start ruld on login with something like rulc -l > /dev/null || ruld &. You can then use the rules in the example bspwmrc These scripts require both lua-posix and lua
  2. Alternatively, create a script that is called in your bspwmrc file that forms the rules. See Stebalien's post or earsplit's config for examples of how to accomplish this.

Both of these methods require installing xwinfo from the AUR or from github

If a particular window does not seem to be behaving according to your rules, check the class name of the program. This can be accomplished by running xprop | grep WM_CLASS to make sure you're using the proper string.

Panels

Currently, bar and dzen2 are supported with bspwm. Check the examples folder on the GitHub page for ideas or the Bar wiki page. The panel will be executed by placing panel & for bar or panel dzen2 & for dzen2 in your bspwmrc. Check the opt-depends in the bspwm package for dependencies that may be required in either case.

To display system information on your status bar you can use various system calls. This example will show you how to edit your panel to get the volume status on your BAR:

panel_volume()
{
        volStatus=$(amixer get Master | tail -n 1 | cut -d '[' -f 4 | sed 's/].*//g')
        volLevel=$(amixer get Master | tail -n 1 | cut -d '[' -f 2 | sed 's/%.*//g')
        # is alsa muted or not muted?
        if [ "$volStatus" == "on" ]
        then
                echo "\f6"$volLevel
        else
                # If it is muted, make the font red
                echo "\f1"$volLevel
        fi
}

Next, we will have to make sure it is called and piped to $PANEL_FIFO:

while true; do
echo "S" "$(panel_volume) $(panel_clock) > "$PANEL_FIFO"
        sleep 1s
done &

Example how to configure after install

Warning: This not yet a finished guide
Warning: Please note that bspwm are under heavy development and can change a lot. This is how I did last time. If something is wrong please correct the faults of it.


1. Copy the supplied bspwm_rules, rule_command, ruld and rulc scripts from Examples to $XDG_CONFIG_HOME/bspwm/ and ensure they are executable.
2. Edit $HOME/.profile to something similar to this:
PATH="/usr/games:$HOME/.config/bspwm:$PATH"

export XDG_CONFIG_HOME="/home/$USER/.config"

## Bspwm
export BSPWM_SOCKET="/tmp/bspwm-socket"
export BSPWM_TREE=/tmp/bspwm.tree
export BSPWM_HISTORY=/tmp/bspwm.history
export BSPWM_STACK=/tmp/bspwm.stack
export PANEL_FIFO=/tmp/panel-fifo
export PANEL_HEIGHT=14
3. Edit $HOME/.xinitrc and add.
source $HOME/.profile &
sxhkd -c $XDG_CONFIG_HOME/bspwm/sxhkdrc &
exec wm 
4. Add this line to $XDG_CONFIG_HOME/bspwm/bspwmrc.
bspc config rule_command "$(command -v rule_command)"
5. Install xwinfo from AUR and lua-posix. Change the rules of $XDG_CONFIG_HOME/bspwm/bspwm_rules to your likening.
$ man bspc
...
rule_command
External command used to retrieve rule consequences. The command will receive the the ID of the
window being processed as its first argument. The output of that command must have the following
format: key1=value1 key2=value2 ..., where keyN is one of floating, fullscreen, locked, sticky,
private, frame, center, lower, follow, manage, focus, desktop or monitor.
...
To find out the window names you can use xorg-xprop. The lower-case 'vlc' is the instance and the upper-case 'Vlc' is the class.
$ xprop | grep WM_CLASS
WM_CLASS(STRING) = "vlc", "Vlc"
6. Restart bspwm and check so the rules have been applied.
$ rulc -l
class == "Gimp" =>floating=on
class == "Firefox" => desktop=^2
class == "Vlc" => desktop=^3
instance == "rtorrent" => desktop=^3
instance == "URthree" => desktop=^3

Troubleshooting

The following environmental variables may need to be defined:

echo $BSPWM_SOCKET
echo $XDG_CONFIG_HOME

If either of these do not respond with a value, then go to your ~/.profile and add the following lines:

export XDG_CONFIG_HOME="$HOME/.config"
export BSPWM_SOCKET="/tmp/bspwm-socket"
Note: You may put these anywhere that is sourced for your user. Another sane place to put these would be as part of your user's ~/.xinitrc, or zsh users might choose ~/.zshenv. User your best discretion.

See also