BSPWM

                                  Bspwm


 

Bspwm is Binary Space Partitioning Window Manager. This is a tiling window manager. If you come from a traditional desktop environment like Xfce, you notice that the primary way of managing open windows is the mouse. Those are floating window managers. :swan:

Then there are tiling window managers, where all windows are visible on the desktop and are automatically arranged so as to fill the complete screen real estate. A tiling window manager doesn’t mean it needs to be controlled via the keyboard, however, the way they function, it is very efficient to use keyboard shortcuts to control your windows.

Bspwm only manages your windows. The keyboard shortcuts are handled by a different program called sxhkd. This is different than i3wm, where the window manager manages your keyboard shortcuts also. :keyboard:

Functioning

bspwm is a tiling window manager that represents windows as the leaves of a full binary tree. :palm_tree:

bspc is a program that writes messages on bspwm’s socket. :electric_plug:

When a program is run, it is placed in a tree, splitting the current branch. Windows can have 4 states - tiled, pseudo_tiled, floating and full screen.

  • Tiled means the window’s size will fill up the maximum area possible without overlapping other windows around it. It will stay in it’s set location based on it’s position in the window tree.

  • Pseudo Tiled is the same as tiled except the window can be resized at will. The position stays the same though.

  • Floating means the window can be placed anywhere on the desktop and resized at will.

  • Fullscreen is pretty self explanatory.

Configuration

Bspwm settings are modified via running shell commands. If you run the same commands every time bspwm starts up, you will get the same configuration. You surely do want some commands to be run whenever bspwm starts, like window border related settings, startup apps etc. These are defined in ~/.config/bspwm/bspwmrc. This file will contain the bspc commands that will be run at startup. It is actually a shell script that bspwm runs at startup so you can put any other shell command you want. You can also use loops, if-else constructs in case you want to do something complex and fancy. (like applying different settings based on the display resolution. That way you can run the same config file across all your systems and still get pixel values tailored to the specific monitor it runs on. :desktop_computer:

Keybindings are defined in ~/.config/sxhkd/sxhkdrc. Apart from bspwm related keybindings, you can also put keybindings for commonly used commands. For eg. I am usually ssh-ing into a system on my network, so I add a command to open terminal and run the ssh command. This is bound to a keyboard shortcut. You can also bind shortcuts to launch commonly used applications. Another thing I recommend binding is the music controls if you use Mpd.

Its totally up to you. Different people have different uses and you can bind whatever you regularly use. Makes your workflow faster. :sparkler:

Bspwm is very feature rich. This is just an introduction; look up on the internet for lot more things you can do with it.

Extra reading :

  1. Readme at https://github.com/baskerville/bspwm explains well how windows are managed.
  2. https://github.com/IntrepidPig/bspwm-doc/blob/master/getting-started.md

 

List of common key bindings. 
All definitions are stored at:

	~/.config/sxhkd/sxhkdrc
	~/.config/sxhkd/sxhkdrc_bspc

The latter is for definitions that control the window manager.  While
the former has WM-independent keys.

Last review 2019-07-01.

Explanation of the basics
=========================

The Super key, aka "mod4", is the one that most keyboards mark with the
Windows logo.  While the key "Return" is also known as "Enter".

Motions are the same as Vim: h,j,k,l (left,down,up,right).

This is the general format of a key chord (aka key binding):

	Super + <key>

And this is a key chord chain:

	Super + <key> ; <key>

The keys "Super", "Alt", "Shift", "Ctrl" are known as "modifiers".

To run a key chord, hold down the modifier and press the key.  Key chord
chains build on that principle: you type the key binding to the left of
the semicolon (;), release the modifier and then type the key (or key
chord) to the right of the semicolon.

In this document, the notation {h,j,k,l} means "any one among" the
comma-separated items.  Whereas {1-4} denotes a range: 1,2,3,4.

Getting started
===============

Super + Return            |-Open a terminal running the "Default" tmux session
Super + Shift + Return    |-Open a generic, yet fully-capable terminal (xterm)
Super + q                 |-Close focused window safely (apps might require confirmation)
Super + Shift + q         |-Kill focused window (no confirmation whatsoever)
Ctrl + Alt + Delete       |-Launch poweroptionsmenu, where you can choose to log out, reboot, etc.

Window motions
==============

Super + {h,j,k,l}         |-Move focus in the given direction == choose which window has attention
Super + Shift + {h,j,k,l} |-Swap focused node with the one in the given direction
Super + Ctrl + {h,j,k,l}  |-Expand/contract tiled node in that direction, provided there is a split
Super + Alt + {h,j,k,l}   |-Set preselection (manual tiling) for next window
                          |---Cancel presel by inputting same command again
Super + Alt + {1-9}       |-Set the presel ratio, relative to the focused node
Super + Shift + <arrows>  |-Move floating window
Alt + right click         |-Drag floating window
Alt + left click          |-Resize floating window from the nearest edge

Window and desktop actions
==========================

Super + Space             |-Toggle between tiled and floating states
Super + m                 |-Toggle between tiled and monocle layout (monocle == maximised nodes)
Super + f                 |-Toggle focused window's full screen view
Alt + Tab                 |-Cycle through windows on the current desktop
Alt + Shift + Tab         |-Cycle backwardly through windows on the current desktop

Desktop operations
==================

Super + {0-9}             |-Switch to the designated desktop (workspace)
Super + Shift + {0-9}     |-Send focused node to the given desktop
                          |---Desktops are created/removed dynamically (my custom setup)
Super + Tab               |-Cycle through desktops on the current monitor
Super + Shift + Tab       |-Cycle backwardly through desktops on the current monitor
Super + r                 |-Rotate the node tree 90 degrees clockwise
Super + Shift + r         |-Rotate the node tree 90 degrees counter-clockwise
Super + Alt + r           |-Mirror/flip the node tree (top left becomes bottom right)
Super + s ; {b,e}         |-Balance or equalise node splits (better try it to get an idea)
                          |---Balance works on the parent node.  Equalise is for all nodes.
Super + Shift + {[,]}     |-Incrementally decrease or increase the gaps between the tiled nodes
Super + Shift + {y,u,i,o} |-Change to gap presents {0,5,10,20}
Super + comma             |-Switch focus to the next monitor (cycles through monitors)
Super + Shift + comma     |-Switch focus to the previous monitor (cycles through monitors)

Launching programs
==================

Super + d                 |-Run dmenu with access to all binaries in PATH
Super + Shift + d         |-Run flatpakmenu with access to all flatpak apps
Super + g ; {1-3}         |-Open graphical apps {firefox,caja,thunderbird}
Super + x ; {3-5}         |-Run a terminal with {mutt,newsboat,ncmcpp}
Super + x ; 0             |-Launch a floating terminal running calc

Useful extras
=============

Super + {F1,Home}         |-Launch a floating window with this cheat sheet
Print                     |-Get a screenshot of the focused window saved to the ~/Desktop
Super + Print             |-Get a screenshot of the entire viewport saved to the ~/Desktop
Super + p                 |-Run passmenu to copy a password stored with the UNIX tool "pass"
Super + x ; w             |-Run a floating image browser, from where you can also set the wallpaper
Super + e ; c             |-Toggle the display compotisor (do this if you have performance issues)
Super + e ; f             |-Toggle BSPWM "focus mode", to remove gaps, the padding, the panel
Super + e ; t             |-Run tempusmenu to select a Tempus theme for a live theme switch
                          |---The Tempus themes: https://gitlab.com/protesilaos/tempus-themes
                          |---Some ports of the Tempus themes are distributed with my dotfiles

Further reading
===============

Study the ~/.config/sxhkd/sxhkdrc and ~/.config/sxhkd/sxhkdrc_bspc.
They are extensively documented.  You will find key chords for tasks not
included herein, such as multimedia keys, setting node flags, and more. 

 

Reacties

Populaire posts van deze blog

Adjust Color Temperature of Your Screen Using Terminal

CrunchBang++ Linux – The Ultimate Lightweight and Stable Linux Distribution

Snapdrop = AirDrop for Windows, Mac, Linux & Android