DEV Community

JDeep
JDeep

Posted on

Bspwm installation on Ubuntu 20.04 [updated :2021]

Note : Donot blindly copy the commands otherwise very bad things will happen.

Step 1 : Install bspwm

either by installing from the debian repository or by building it from source .I will be using the debian repository for installation
Run the following commands. Use sudo if you are not root

apt-get update && apt update
apt install bspwm
Enter fullscreen mode Exit fullscreen mode

You should get a prompt like this :

alt text

See carefully that the dependencies like bspwm lemonbar libxcb-ewmh2 sxhkd xdo are automatically installed so you dont have to install these manually. Keep in mind though that if you are building from source , you would need to install these dependencies manually either from debian repository or by building them from source


Step 2 :Configuring bspwm and sxhkd

Now the bspwm file was downloaded into your system and in almost all cases, the files are found in /usr/share/doc/bspwm

In this folder , there are example config files that you can use. Or if you want , you can make your config files from scratch.
I will be using the examples configs to wrap it up faster

From /usr/share/doc/bspwm/examples we will copy the bspwmrc and sxhkdrc to ~/.config directory

First make two directories (bspwm and sxhkd) in your .config folder.

Next copy the bspwmrc and sxhkdrc in /usr/share/doc/bspwm/examples to your .config directory using the following commands

mkdir ~/.config/bspwm && mkdir ~/.config/sxhkd
cp /usr/share/doc/bspwm/examples/bspwmrc ~/.config/bspwm
cp /usr/share/doc/bspwm/examples/sxhkdrc ~/.config/sxhkd
Enter fullscreen mode Exit fullscreen mode

Step 3 : Making executables and firing up bspwm

Normally , the bspwmrc file that you copied just now should be an executable. You can check if its an executable or not from the this SO post or if you have a file manager like vifm or ranger then , placing the cursor on bspwmrc file should highlight it in green colour (which means that its an executable and you can proceed to the next step)

See this:

alt text

If its not executable , then make it executable by

chmod +x bspwmrc
Enter fullscreen mode Exit fullscreen mode

Step 4 : Modifying the .sxhkdrc so that you can open some apps after logging into bspwm.

If you did the above steps correctly , you should see something like this in your sxhkdrc

alt text

Now change the default urxvt terminal to the terminal of your choice. I will set super + Return to my default gnome-terminal.
You can also add your keybindings for opening web browser.


Step 5 : Putting bspwm in your .xsession or .Xsession or xsessionrc or .xinit file.

Note 1 : Focus on the or in the heading. That means to do the following steps in only one file not all :-)

Note 2 : Check if you have any the files in the heading in your home directory. In my case I didn't have them so I had to make them.

Making these files are simple. Just touch .xsessionrc .

Edit the file and put the following lines in it :

#!/bin/bash
exec bspwm
Enter fullscreen mode Exit fullscreen mode

Note 3 : I got my bspwm running by adding the above lines in .xsessionrc . It may be possible that in your case you have to add the lines in .xsession or any other file mentioned in the heading.


Step 6 : Making the xsession file executable

First cd to your home directory where you have the file you created/modied in Step 5.

Then open the terminal and enter the following :

chmod +x  .xsessionrc
Enter fullscreen mode Exit fullscreen mode

Note : I created a .xsessionrc file. If you have used any other file in Step 5 , then make it executable instead !

Logut and login again and you will be greeted with a black screen.

Use the keybinding you added in Step 4 to open up the terminal and install essentials like polybar , picom etc

Sources:

https://dev.to/l04db4l4nc3r/bspwm-a-bare-bones-window-manager-44di

https://www.maths.cam.ac.uk/computing/linux/X/xsession

https://github.com/baskerville/bspwm/wiki

https://wiki.archlinux.org/index.php/bspwm

Top comments (1)

Collapse
 
nigredotori profile image
Dmitry Polienko

If you're using Ubuntu's default display manager (GDM3), then you don't need to edit your .xsession. BSPWM APT package adds /usr/share/xsessions/bspwm.desktop, and GDM3 finds it automatically. The caveat is that GDM3 doesn't re-scan this directory, so you have to restart it (e.g. by rebooting). You can then choose your preferred session on the login screen (the cog button in the bottom right).

I haven't tried this with other display managers, but I would imagine that at least some of them support /usr/share/xsessions/ as well.

Also, one thing that I would add to this guide is setting up a simple help shortcut, as described here. It's frustrating to be locked in a keyboard-centric application without a clear/fast way to see what the commands are. Kind of like entering Vim by mistake. 😄