How to Install Bspwm

Upon request, and boredom, I am going to write up a quick guide on how to install Bspwm, a panel (bar), and a nice default config, hopefully an understanding of how to interact withBspwm, and configure it.

Bspwm is a tiling window manager with some really nifty features, and Sxhkd is a hotkey program made by the same guy, that just works really well alongside Bspwm (it is always smart to keep autostarts and hotkeys WM/DE independent).

For those who haven't built a package from source before, go ahead and check to see if Bspwm and Sxhkd are in your repos. If not, no big deal - they probably aren't. The easiest way to install this will be through source, anyway - something of this size takes little to no time to compile.

First of all, you're going to need git if you don't already have it. Install via whatever package manager or software center your distro uses. Not sure if this is the right audience to ask this question, but if you aren't running X, Bspwm is an X based WM, so make sure you have X and an appropriate video driver for X as well. You will need Xcb for Bspwm, so install the appropriate libs for Xcb as well (different names on different distros). For compiling, in the off chance your distro doesn't have them, install gcc and make.

Open up your terminal, and pull Bspwm and Sxhkd from upstream.

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

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

For those who don't know any git stuff, that is just pulling the source code from the repos they are being "hosted" (well...) on at Github (Github is not Git, just a popular service). Now, cd into the bspwm folder, and compile it.

make && sudo make install

cd ..

Now, cd into the sxhkd folder.

There should be a folder in the bspwm called "Examples" which has stock config files for Sxhkd and Bspwm. They go in the ~/.config directory, like most configs should, but hardly ever seem to. Go ahead and make sub directories for both Bspwm and Sxhkd, then copy the configs over, and allow them to be executed.

mkdir ~/.config/bspwm

cp /where/you/put/bspwm/examples/bspwmrc ~/.config/bspwm/bspwmrc

mkdir ~/.config/sxhkd

cp /where/you/put/bspwm/examples/sxhkdrc ~/.config/sxhkd/sxhkdrc

chmod +x ~/.config/bspwm/bspwmrc

chmod +x ~/.config/sxhkd/sxhkdrc

Since this is an X based WM (for now), go ahead and start it up in your xinitrc (~/.xinitrc). Just scroll to the bottom, comment out whatever WM or DE you are currently using (should be something along the lines of "exec gnome-shell" or "exec openbox-session" - comments are pounds - #), and add the following in its place.

sxhkd &

exec bspwm

That's it, should be installed with stock settings. That are fairly good looking. When you reboot, it should boot into a blank session, no terminal, no bar, nothing. Press Mod + Enter (by default, Mod4, so Super + Enter), and it will spawn a terminal (either xterm or Urxvt by default - pretty sure it's urxvt). You probably have one of the two installed, but if not, switch to another VT, login, and install urxvt - and while you're at it, grab xterm (good to have xterm anyway, since it seems to be called by some X programs).

Since you probably aren't crazy, and want a bar/panel, things change a bit. You already have Bspwm installed, and can control it via Sxhkd. However, we're going to want to include space for your panel, and the panel itself. If you're an Xfce4 user, and want to use the Xfce4 panel, you can, or you can use Dzen2, BAR, Bar with Dzen, or any of the hundreds of esoteric bars out there. I use Bar with Dzen2, but since most users don't need the useless eyecandy and pain of Dzen2 clickiness, let's install Bar.

Essentially the exact same way - pull the repos, build the source, and add a few things to your PATH. Pretty basic Linux stuff that's good to know regardless.

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

git clone https://github.com/baskervile/xtitle.git

Build those the same way you built Bspwm and Sxhkd.

Now, there are lots of Bars, but we will be using Bar Aint Recurive - BAR - since it's UTF8, and all that jazz.

git clone https://github.com/LemonBoy/bar.git

Again, build it the same way. When it's compiled and installed, go ahead and make a directory to put the scripts for the panel config. It doesn't matter whatsoever where you put it, so I keep them on my secondary HDD, for backup reasons. You might consider making a directory in you home, such as ~/Scripts. Doesn't matter. Where ever you might make it though, it needs to be included in your path. Since most distros come with Bash, and use Bash, as the shell, and not Zsh, or Fish, or something esoteric, we'll edit your /etc/profile. Instead of using Gedit, or Geany, or some GUI editor, it is easiest just to use nano, vi, vim, or even a cat to add the text to your Bash profile. It is owned by root, though, so simply run sudo in front of the command (e.g., sudo nano /etc/profile). We need to add the path to the directory of your panel scripts, and declare the PANEL_FIFO variable, copy the panel scripts, and then you're set.

Scroll down to where it says PATH="/.../", and add the following to the end, inside of the closing quotation mark:

:/path/to/your/scripts/directory

export PANEL_FIFO="/tmp/panel-fifo"

I realize that may sound confusing, so here is a quick screenshot of top of my /etc/profile (which is emulated by my Zsh profile)

<img src='/uploads/default/5198/258ed496defa3b92.png'>

Easy enough, right?

Now, just copy the panel scripts from the Bspwm folder, and chmod them, and make sure the panel is set to startup at the start of X.

cp /bspwm/examples/panel/panel /path/to/scripts/folder

cp /bspwm/examples/panel/panel_colors /path/to/scripts/folder

chmod +x /path/to/scripts/panel

Go ahead and add "panel &" after sxhkd in your xinitrc so that the panel starts automatically, and reboot, and you're set! Bspwm, and a panel. Configs are easy, and plentiful online. Ask if anything is unclear, or you want my dotfiles.

Happy hacking!

I'm supposed to compile Sxhkd correct?

After following the entire guide I get this:

super+enter does nothing and I have no mouse.

EDIT: I had an @ instead of &.

Sorry, didn't see your question. I'm assuming you have it working now, then?

If BAR is the thing at the top of your picture then it did not work.

For a good reason; it isn't running. Add "panel &" after sxhkd in your .xinitrc.

Is it possible to use Openbox but use Bspwm for tiling?

Well, Openbox is a WM, and Bspwm is a WM, so no. You could use a DE like Gnome with Bspwm for tiling, though.

My bar is refusing to start. 

 

#!/bin/sh
#
# ~/.xinitrc
#
# Executed by startx (run your window manager from here)

if [ -d /etc/X11/xinit/xinitrc.d ]; then
for f in /etc/X11/xinit/xinitrc.d/*; do
[ -x "$f" ] && . "$f"
done
unset f
fi
#exec gnome-session
# exec startkde
# exec startxfce4
# ...or the Window Manager of your choice
sxhkd &
panel &
exec bspwm

What does "echo ${PANEL_FIFO}" tell you? If nothing, then that's probably the reason the panel won't start. Make sure the panel scripts are executable, and you own them. Plus, make sure the directory to where the scripts are is in your PATH.

hey brennanriddell, thanks for the guide for this. its sweet. Will bspwm show up in GDM's session list at login just like any other WM?

 

I don't use a display manager, so I don't know - I would assume GDM is smart enough, but I haven't used a DE in a while.

I checked over everything, and it looks fine, when I run "panel: in terminal, I get

[[email protected] ~]$ panel


Failed to connect to the socket.


Failed to connect to the socket.


Could not load font -*-terminus-medium-r-normal-*-12-*-*-*-c-*-*-1

 

Even though I installed that font, and did everything in the Wiki for that specific font.

What is your setup like?

I installed "terminus-font" and "terminusmod" 

I tried to run "bar" and just got 

[[email protected] ~]$ bar


Could not load font -*-terminus-medium-r-normal-*-12-*-*-*-c-*-*-1

 

I know I have the font installed. And my font directory is set correctly.\

edit: also ran 

xset +fp /usr/share/fonts/local

xset fp rehash

With no luck.

AHA. Never mind. 

I had to set up my .xinitrc like this.

#exec gnome-session


# exec startkde


# exec startxfce4


# ...or the Window Manager of your choice


xset +fp /usr/share/fonts/local


xset fp rehash


sxhkd &


panel &


exec bspwm

 

But now my windows cover the bar, how do I set boarder so they wont cover it?

What do you mean?

You need to install SLiM.

My home folder doesn't have a .xinitrc . Making one with the specified commands didn't fix anything - seems like the file might be elsewhere. Do you know of anywhere else it might be? (I'm running Arch + XFCE4.)

Should be one in /etc/X11, called xinit. Run

"# cp /etc/X11/xinit ~/.xinitrc"

to copy it over.