Bspwm Installation and Configuration

by rajun8 in Circuits > Linux

102258 Views, 5 Favorites, 0 Comments

Bspwm Installation and Configuration

bspwmgoal.png
test.png

Bspwm is a window manager for Linux that arranges windows in a tiling format. Instead of managing your windows with your mouse, you can execute a few keystrokes. This saves time and can help with RSI (repetitive strain injury) due to a reduction in excessive movements between the keyboard and the mouse. From the keybindings to the window borders, everything is customizable. However, it can be daunting to install at first as it is not available in every package manager. This guide will allow you to fully install and understand how to customize your new window manager. The first image above is the end goal for this guide. You can do further tweaks to get to the second image.

Time to Install

  • 1 hour

Space and dependency limitations

  • git
  • ~10mb amount of space on drive
  • Linux distribution

Steps

  1. Clone git repositories
    1. Prerequisite
    2. Program information
    3. Cloning
  2. Go to directory and compile
    1. Navigating to directory
    2. Commands to compile
  3. Copy config files and modify your keybindings
    1. Copy config files
    2. Keybindings
  4. Execute bspwm on startup
  5. Practice Key Bindings and Additional Resources

1. Basic key bindings

2. Additional resources


Clone Git Repositories

pic1.PNG
pic2.PNG
pic3.PNG

Prerequisite

You must have git installed. Git is used to fetch files from source. If not, execute the package install command for your Linux distribution.

Ubuntu: https://help.ubuntu.com/lts/serverguide/package-management.html

Arch: https://wiki.archlinux.org/index.php/pacman

The current guide can be done with almost no Linux knowledge, but if you would like to understand what the commands you are entering in your terminal are, consult http://www.ee.surrey.ac.uk/Teaching/Unix/. The provided link will give you most of the knowledge needed to understand what the commands you are typing mean and other essential Linux knowledge.

Program information

bspwm is short for binary space partitioning window manager. You can think of bspwm as a tiling window manager that can make you more productive and allow you to achieve a more streamlined workflow.

sxhkd is short for simple X hot key daemon. sxhkd is used to relay keyboard shortcuts so that the window manager, bspwm, can respond accordingly.

Cloning

We will first clone the git repositories that contain the programs we would like to install (bspwm and sxhkd).

Execute these commands:

git clone <a href="https://github.com/baskerville/bspwm.git" rel="nofollow">https://github.com/baskerville/bspwm.git</a>
git clone <a href="https://github.com/baskerville/sxhkd.git" rel="nofollow">https://github.com/baskerville/sxhkd.git</a>

Go to Directory and Compile

pic4.PNG

Navigating to directory

To navigate to the directory of the two programs you just downloaded:

cd bspwm

or

cd sxhkd

Compile

Now within each directory:

make & sudo make install

You will be prompted for your password; root access is necessary to install.

Compilation may take some time depending on your computer's hardware.

Make sure the files within your bspwm and sxhkd folders are similar to the ones in the picture.

Copy Config Files and Modify Your Keybindings

pic5.PNG

Copy Config Files

First we will make a directory to copy the base configuration files for bspwm and sxhkd.

To make the directory:

mkdir /home/(your user name here)/.config/bspwm

To copy the files:

mv /bspwm/examples/bspwmrc /home/(your username here)/.config/bspwm/bspwmrc
chmod +x /home/(your user name here)/.config/bspwm/bspwmrc

Do the same with sxhkd:

mkdir /home/(your user name here)/.config/sxhkd
mv /sxhkd/examples/sxhkdrc /home/(your username here)/.config/sxhkd/sxhkdrc
chmod +x /home/(your user name)/.config/sxhkd/sxhkdrc


Keybindings

Now to properly use bspwm, you will need to modify the keybindings to your liking.

This can be done in the sxhkdrc file.

To access this file, open the file using your chosen editor.

Ex.

vim /home/(your user name)/.config/sxhkd/sxhkdrc

Now modify the keybindings to your preference. The image contains a suggested example. The word super refers to the windows key on your keyboard between the left ctrl and alt key. Note that Konsole can be replaced with any terminal emulator of your choice like urxvt, terminator, gnome-terminal, etc.

Execute Bspwm on Startup

bspwmgoal.png

Startup

To execute bspwm on startup, edit /home/(your user name)/.xinitrc and add

exec bspwm 

at the end of the file.

Example to access the file:

vim /home/(your user name)/.xinitrc

Now type startx and bspwm in the terminal.

startx & bspwm

Use your created keybindings to open the programs you desire and enjoy your new tiling window manager!

If you followed the suggested keybinding earlier, the super (windows key) + the enter key will open a terminal. Try doing this action twice. You should end up with two windows tiled similarly to the image above.

Practice Key Bindings and Additional Resources

test.png

Basic Key Bindings

There are quite a few key bindings present in the sxhkdrc file we recently looked at. If you decided to not heavily modify the default sxhkdrc file, these key bindings will work for you.

Opening a new terminal:

Super key (windows key) + enter

Closing a window

Super key + w

Switching between virtual desktops (default is 10, can be unlimited!)

Super key + [Numbers 1-10]

Moving windows to another virtual desktop

Super key + shift + [Numbers 1-10]

Starting a program with dmenu (application launcher)

Super key + space bar

Resizing a window

Super key + right mouse button on corner of the window you want to resize

Full screen a window

Super + f

Restoring window to tiled layout

Super + t

Additional Resources

All the key bindings you have just learned will allow you easily use and navigate bspwm. However, there are plenty of key bindings to still discover, or possibly even create. If you are interested, read the sxhkdrc file thoroughly along with the wiki at https://github.com/baskerville/bspwm.

To create a custom start bar, I suggest using https://github.com/jaagr/polybar. Polybar is easily configurable and light weight. Polybar works well with bspwm, so it is an ideal place to start before you move onto another start bar.

To allow for transparency, try https://github.com/chjj/compton. Compton allows you to have transparent windows, shadows, beautiful fade in effects when switching between desktops, and more. Compton will however require more system resources depending on your level of use, so be wary.

For an alternative application launcher, https://davedavenport.github.io/rofi/ works well. Rofi is easy to customize and you can quickly launch installed programs. Like dmenu (the default application launcher), rofi can also take in command line parameters during launch.

Happy ricing!