Install BSPWM and SXHKD

In this article we are going to follow the basic steps to install bspwm and sxhkd, which, as I indicated in the introduction, are the window manager and the keyboard shortcut manager. In addition to this, we will make some other modifications to the configuration that comes out of the box, to make sure that everything works according to our tastes , and I will indicate some keyboard shortcuts to facilitate the transition.

Before continuing, let me tell you that it is important that you at least know the basic keyboard shortcuts , because otherwise, the experience will be frustrating , and I am telling you, because I have experienced it myself . The first time I tried i3 , and realized that it was not able to do anything at all , I felt really lost . You need to at least know these keyboard shortcuts before launching into bspwm and sxhkd.

Installation

Both in Ubuntu and derivatives, as in the case of Arch, Manjaro and derivatives, the installation of bspwm and sxhkd, that is, the window manager and the keyboard shortcut manager is a really basic operation. For the first case, for Ubuntu and derivatives, you simply have to run,

sudo apt install bspwm sxhkd

In the case of Arch, Manjaro and derivatives, the installation is solved with the following,

sudo pacman -S bspwm sxhkd

Once bspwm and sxhkd are installed, and before logging out, and logging into your brand new window manager , it is necessary to configure and do a first approximation to improve your workflow.

So what you have to do is copy the files found in the directory /usr/share/doc/bspwm/examples/to your config directory . Create the directories and copy, to do this execute the following instructions in a terminal,

mkdir -p ~/.config/bspwm
mkdir -p ~/.config/sxhkd
cp /usr/share/doc/bspwm/examples/bspwmrc ~/.config/bspwm
cp /usr/share/doc/bspwm/examples/sxhkdrc ~/.config/sxhkd

The next step is to ensure that the bspwm configuration file bspwmrc is an executable file. Although you could just check it, run the following statement and make sure,

chmod +x ~/.config/bspwm/bspwmrc

A look at the BSPWM configuration file

Once you have the configuration files on your site , the time has come to take a look at them, and if necessary, modify them to suit your needs. To give you an idea, the bspwm configuration file looks like the one below,

#! /bin/sh

pgrep -x sxhkd > /dev/null || sxhkd &

bspc monitor -d I II III IV V VI VII VIII IX X

bspc config border_width         2
bspc config window_gap          12

bspc config split_ratio          0.52
bspc config borderless_monocle   true
bspc config gapless_monocle      true

bspc rule -a Gimp desktop='^8' state=floating follow=on
bspc rule -a Chromium desktop='^2'
bspc rule -a mplayer2 state=floating
bspc rule -a Kupfer.py focus=on
bspc rule -a Screenkey manage=off

The first thing is to tell you that this is nothing more than a script. A more or less complex script, in which you are going to configure the behavior of your window manager. For example, the first of the lines,

pgrep -x sxhkd > /dev/null || sxhkd &

In this line the first thing that is done is to stop sxhkdand restart it in the background with sxhkd &.

From here on, all the lines that start with bspcwhat they do is modify and adapt the behavior of bspwm. The first few lines, those beginning with bspc configrefer to the manager itself, while those beginning with bspc rulerefer to the behavior of windows in the manager. For example,

bspc config border_width         2
bspc config window_gap          12

With these two lines you set the border of each of the windows to 2 and the space or gap between windows to 12.

On the other hand with this for example,

bspc rule -a Gimp desktop='^8' state=floating follow=on

What you do is make it Gimp go to desk number 8 and it’s in a floating state.

Desks

It is important to note that most, if not all, Linux desktop environments and window managers use multiple desktops. In the case of Tiling Window Managers , this is more important.

The fact that the windows go to a certain position on your desktop means that you have to manage where you want. For example, you can define that all graphic editing applications go to a certain desktop.

For example, in my case, I have defined that the terminals always open on the desktop 7. I currently have 2 monitors so I have 6 desktops on one screen and 7 to 10 on the other screen. This is so, for the simple fact that I have a split desktop, and in the first half there is from 1 to 6… This is the great advantage of mosaic-type window managers , you can adapt them exactly to your needs or workflow.

A LOOK AT THE SXHKD CONFIGURATION FILE

In the case of the configuration file sxhkd, this is a bit more extensive , but not for that reason more complex. Simply what you will find are keyboard shortcuts along with commands to either launch an application or work with bspwm.

Thus, the first lines are the most important,

# terminal emulator
super + Return
    urxvt

# program launcher
super + @space
    dmenu_run

With super + Return you bind that combination of keys to urxvt. Tell you that it urxvtis a terminal emulator . Here you have two options either install this terminal emulator or install your own. In my case, my recommendation is that you install either kitty or alacritty , due to their speed and execution possibilities.

So in my case, this statement becomes,

super + Return
    kitty

You can always use the settings sxhkdto find out which keyboard shortcut you have assigned to which operation or application. So at any time open a terminal super + Return and look in ~/.config/sxhkd/sxhkdrcto discover the keyboard shortcut you don’t remember.

The following keyboard shortcut super + @space associates this combination with dmenu.

If you don’t know dmenutell you that it is a light launcher. This launcher sits at the top of the desktop. This is important for you to know, because it is the way to start an application or even to leave your desktop.

Remember that to launch any application you have to do it using dmenu. The key combination to launch any application is super + @space.

It is important that you know, and even have these keyboard shortcuts written down until you get used to them. So I indicate some of the most interesting,

  • super + alt + qallows you to exit bsqwm
  • super + wclose a window
  • super + mswitch between mosaic mode and single app mode
  • super + {h,j,k,l}, with super + hyou change the focus to the application on your left. With super + j, you do it to the one at the bottom, with kthe one at the top and with lthe one at the right. Note the notation, which is the same as it appears in the configuration file.
  • super + alt + {h,j,k,l}resize the window you are in to the right, up, down or left respectively.

Remember especially the first of the instructions, super + alt + q which is the one that allows you to exit bspwm .

In any case, I recommend that you take a look at the configuration file sxhkd before restarting the session and write down those keyboard shortcuts that you find most interesting.

Last obervation

With this simple configuration of both the window manager and the keyboard shortcut manager, you have the most basic configuration. You don’t have a top panel, or an indicator area, or anything… It is a very basic configuration, and it is very possible that you lack information to be able to work with enough ease.

For this reason it is

that you install some addition

Conclusion

At this point in the installation of bspwm and sxhkd, you will have already realized how important the keyboard, and in particular keyboard shortcuts, is, and how little importance is given to the mouse. Yeah, the mouse doesn’t even show up anywhere . And it is that, as I have indicated on other occasions, mosaic type window managers are oriented to the use of the keyboard .

You have to keep in mind the use of the keyboard in your relationship with this type of window manager, and if you want to be as productive as possible , memorize the keyboard shortcuts and forget the use of the mouse as much as possible.

al tools as I indicated in the introduction. But we will see this later, in the following articles.

Leave a Reply