BSPWM

By Penguin007

B S P W M stands for Binary Space Partitioning Window Manager and is a tiling window manager.

Bspwm is not a DE but it handles the look and behaviour of your system window(s) also called a tiling window manager.

A window manager functions exclusively on assigned keyboard key functions or key combinations, called Keybindings.

For Keybindings, we need another program like SXHKD which stands for Simple X Hot Key Daemon.

The combination of BSPWM and SXHKD work superbly together, also both packages are written by the same creator named Baskerville.

In this tutorial, I will compile Bspwm and sxhkd from source but you can install it from the AUR if you prefer, both git version and latest stable version are available in there.

I don’t use any display managers so this guide will not include the use of one.

Following this guide, it will take approx. 15-20 minutes to have a working set-up.

For a nicely risen set-up including poly bar, Dunst and rofi it will take approx an hour.

A few dependencies are needed and we can install those with:

sudo pacman -S libxcb xcb-util xcb-util-wm xcb-util-keysyms

It’s most likely you have it already installed but better be safe than sorry.

With that out of the way, we are ready to start.

First of all, we start by cloning bspwm and sxhkd repos you can do so by typing the following in the terminal:

git clone https://github.com/baskerville/bspwm.git

 git clone https://github.com/baskerville/sxhkd.git

Now we can cd into bspwm and type the following:

cd bspwm

make

sudo make install

We now do the same with sxhkd:

cd sxhkd

make

sudo make install

Now we’re going to copy the example configuration files so we have something to get us started. But first, we need to make a directory to copy them to:

mkdir -p ~/.config/{bspwm,sxhkd}

We copy the example files with:

cp /usr/local/share/doc/bspwm/examples/bspwmrc ~/.config/bspwm/bspwmrc

and

cp /usr/local/share/doc/bspwm/examples/sxhkdrc ~/.config/sxhkd/sxhkdrc

The Bspwm configuration file is a shell script so we need to make it executable:

chmod u+x ~/.config/bspwm/bspwmrc

As we don’t have any display manager and we want to start Bspwm at login we need to add it to the bottom of  ~/.xinitrc by typing:

exec bspwm

We are not all there yet but congratulations!! You should now have a working Bspwm set-up.

As the example files presume you use certain programs we will install a specific terminal  for the ease of use, just to get started:

sudo pacman -S rxvt-unicode

Reboot your computer, type in your username and your password, then startx.

You should now see a black screen.

mod + return will open a terminal and type urxvt

and it will fill the whole screen – now open a new terminal and you will see how tiling works. You will now have 2 terminals splitting the screen. Go ahead and continue to open more and see how the automatic scheme places the terminals on your screen. There are different schemes you can change between I prefer spiral but tbh I mostly use preselection.

To close a window:

mod + w

You can decide where you want your next terminal to go by using preselection instead of Bspwm deciding for you.

mod + ctrl + h,j,k,l      (representing left,down,up,right)

and you will see a preselected area where your next window will open.  Go ahead and try it.

My personal preference is to use termite so I always install that one first but you can choose whatever you prefer.  We then use our preferred editor to edit

sudo nano /.config/sxhkd/sxhkdrc

Just look for the line with the terminal emulator (one of the first lines) and edit it to the one you installed – in my case I remove urxvt and add termite instead. Easy right?

I recommend that you look at the sxhkdrc file to see which keybindings are used and edit it to your personal preference.

Bspwm out of the box looks kind of sparse – there’s nothing fancy about a black terminal.  But this is easy to fix – you just need to use bspc to configure it

For example, if you want some white window borders

bspc config normal_border_color "ffffff"

If you want the focused window to have a red border type

bspc config focused_border_color #900900"

If you love those thick borders:

  bspc config border_width 6

The possibilities are almost endless.

We can change automatic split schemes -split ratios – add/remove gaps etc etc

If you use a mouse  this is a good config, to begin with;

  bspc config focus_follows_pointer true

So – as it says – whatever window your cursor hover over – is in focus

Some of my personal “must have’s”

  bspc config split_ratio          0.50

  bspc config single_monocle       true

  bspc config borderless_monocle   true

  bspc config gapless_monocle      true

  bspc config pointer_follows_focus false

  bspc config center_pseudo_tiled true

For these configurations to be persistent you need to add it to the bspwmrc file.

I recommend using zsh with auto-complete, it’s an easy way to find all the options bspwm has to offer.

You can just type bspc and hit tab. If it’s configuration options you’re looking for – well you can type:

  bspc config

Then hit TAB and it will show you all the configuration options.

Also man bspc is a nice way to learn more.

As mentioned bspwmrc is a shell script so you can write your own external rules to add to/change the behaviour of bspwm.  If you don’t know how to write scripts there’s a lot of configs on GitHub where you can copy/paste stuff you like to implement.

Okay, so now you have a working basic bspwm set-up but it would be nice to have a fancy bar and a program launcher and perhaps some sort of notifications right?

I recommend polybar – rofi and Dunst.

They all look nice out of the box and are easy to configure without any knowledge of scripting.

Just look at the configuration files for the specific program and you’ll see what to edit and/or comment. These are all very lightweight programs.

There are other options out there too ofc – but for a beginner, I think polybar rofi and Dunst is the best starting point because the configuration files are human-readable.

Now start making your own amazing Bspwm and don’t be afraid to mess up the configuration files.  Remember, we have bspc so you can change things before you actually edit the config.

Try it out before you decide if you actually want it in the file. And you can always start over by copying the examples files as you did in the beginning.

Have fun and Happy Tiling   🙂

Follow us:

Start the discussion at forum.endeavouros.com

%d bloggers like this: