Getting Started with BSPWM and Arch Linux + BlackArch

1 reply [Last post]
Erra's picture
Joined: 2014/05/01

For this, I am going to assume you know how to use editors to edit files and have had a glimpse or idea of how tiling window managers work. I am also going to assume you're familiar with how to launch dmenu from a keybind, the basic Linux File structure, how to effectively navigate it with a terminal, and that you are using wifi. Why BSPWM? Because F@#K i3 thats why; the config file it uses is way too long, complicated, and meshes the keybinds on it, also i3 uses too many dependencies such as i3-gaps in order to get to a working UI that isn't an eyesore. BSPWM solves this by separating the files for the UI confguration into two small files, both of which are easy to work with, and that's all you need.

[UPDATE] On the last version of this guide I told people to use Anarchy Linux to install Arch Linux, now I recommend using the revenge installer, the Anarchy Linux site has gone down most likely due to funding cuts, I also recommend that when you do install it, you DO NOT take the revenge OS repo:

I figured that since the same thing that happened to arch anywhere could happen to it, that it wouldn't be worth it to use their repositories. Also due to an unfortunate commit that was applied to polybar on back in December 2017, I replaced my old config file that used Awesome Font with one that uses only Unifont. Something in its recent update drops unmatched characters that are actually matched by the I don't have the time to look into it, but hopefully it will get resolved later. Still I won't stop you from using Awesome Font. Also, I revamped this guide so things are easier and you don't have to type so much like before. [ENDUPDATE]

For the purposes of this tutorial, the only things you need are your hands, and a png file of your favorite desktop wallpaper. The images I am using are here (save these to your pictures folder when you complete step 2):

The end result is this (I've embedded it to save space):

My Desktop

Anyway, lets begin.

[STEP 1]

I recommend using Arch for BSPWM because I find it much easier to install the dependencies using the Pacman and Yaourt repositories than the Debian and Redhat counterparts. Also it makes you look cooler and has the coolest logo out there... so just do it.

Make sure that having installed Arch you have installed Bash, FireFox, and Network Manager (nmcli). Once the revenge installer installs arch into your hard drive, you will be prompted with a screen asking you whether or not you want to reboot, shutdown or chroot into the system, do not reboot or shutdown just yet; instead chroot into the newly installed system and it should bring up a terminal.

To make BSPWM work, you need to install the sxhkd program (this doesn't happen when you choose BSPWM as your window managerin the installer), and you need to create two files called bspwmrc (controls your window manager) and sxhkdrc (stores all your keybinds), inside a hidden folder in your home directory that holds all of the files for all of your configurations for all of your installed programs (I will refer to them as packages from here on).

So start off by changing the directory to the home folder (/home/yourusername), make a .config folder and in it make a folder for bspwm and sxhkd:

#pwd <- should print out /home/yourusername
#mkdir .config
#chmod 777 .config
#cd .config
#mkdir bspwm sxhkd

Navigate to the bspwm folder, use nano to edit a new file called “bspwmrc” (nano bspwmrc) then open up firefox and go to this raw github link:

highlight everything by pressing ctrl+a and paste it into the empty file in nano (that's the best part about nano, you can copy and paste things into the terminal). Save it by pressing ctr+x then pressing enter and run this to make it an executable:

 #chmod 777 bspwmrc #yes I know you could just write +x but for good luck just do lucky number 7

Do the same in the sxhkd folder and create a file named "sxhkdrc" in it, and copy the stuff in this link with nano as before, you don't need to chmod this:

Last thing you need to do is to install the thing that activates your keybinds, that's right install sxhkd the program, and along with it install dmenu and rxvt-unicode (your new terminal). To do this simply run in the chrooted terminal:

#pacman -S dmenu sxhkd rxvt-unicode

Now alas brave warrior, find a way to reboot your system, and log into bspwm with whatever desktop manager you chose to install. Some keybinds to note are super + spacebar for dmenu, super + alt + escape to log out, and super + enter to bring up urxvt. Note if you haven't used dmenu, it's a handy little program that allows you to bring up any software by typing it in.

[STEP 2]

If everything works open up urxvt by pressing super + enter, and use nmcli and nmtui to connect to a wifi access point if you using wifi (consult the arch wiki for any dhcp configuration); to help yourself, you can use:

$iwlist scan | grep SSID

On urxvt to scan for an SSID. Connecting to wifi with the connection editor involves you having to invoke the connection via terminal if you're not going to use the applet on your bar. To do this edit and name your connection, and then run:

$nmcli c up <yourconnectionname>

Arch Linux has two main repositores (places to get software), the Arch Official Repository denoted as Extra, for this you use pacman, and the community denoted by AUR (Arch User Repo), and for this you need an AUR package manager, it's best to use yaourt so follow this guide and install it:

Now you can install all the extra stuff [all the softwares you want or will need]:

$sudo pacman -S tumbler evince xbindkeys binutils make flashplugin thunar raw-thumbnailer pulseaudio pulseaudio-alsa pavucontrol mpv unzip unrar p7zip deluge smplayer audacious gimp compton file-roller

$yaourt -S lightdm-gtk-greeter-settings nitrogen w3m gpick sublime-text-dev neofetch polybar rofi libxcb python2 xcb-proto xcb-util-image xcb-util-wm xcb-util-xrm cava cairo cmus cmatrix bash-pipes libreoffice lxappearance numix-icon-theme-git siji-git ttf-unifont ttf-font-awesome ttf-anonymous-pro noto-fonts adobe-source-code-pro-fonts feh --noconfirm

Now you are ready to cook rice.

[STEP 3]

Download your desired wallpaper from the internet, but before doing anything, to get the color scheme setup right you are going to need a tool called Wal. Wal is a script written in python that when run, not only sets your wallpaper, but also sets the colors of the wallpaper on URxvt, read everything on the github link of the creator and feel free to donate (> ^ ~ ^)> :

Save the Wal script anywhere you want as a standalone one without an extension and chmod it to and executable, once it is an executable put it in /usr/bin:

$sudo chmod +x wal
$sudo mv wal /usr/bin/

For BSPWM if you want to run this automatically upon login, put this line in your bspwmrc file somewhere:

wal -i path/to/wallpaperorpicture &

To make the appearance of URxvt look nice you want to make a file called .Xresources, drop this file in your home directory, the dot in front of the name hides the file from view like the .config folder, but you can use your file manager options to view it if you need to. My version of .Xresources is this:

Don't worry about editing this file for colors, wal will change all the colors for your terminal each time you log into your account.

[STEP 4]

So far I’ve made you install things without question, but now you want to really start digging into the butter of all of this. So lets start with your file manager, Thunar, opening thunar, using dmenu, or a keybind of your choice, you can see that the icons aren’t pretty, so to modify them use lxappearance, which is a software you can run from your dmenu. For your sake I’ve gone ahead and visited the github for the arc dark red theme because who doesn’t like red themes?

Read this and follow the instructions to get the theme into your computer. Alternatively, download it and drop the folders in /usr/share/themes/. Once that is done open up lxappearance and adjust the settings to use Arc Dark Red and the numix icon theme because screw adawita.

To configure the style and font on urxvt, put the sufff in the link below in a file called .Xresources which is located on your home directory (Do not ask me where this came from, just know you can modify this anyway you want later) (also if it doesn't exist make a new one and name it .Xresources); if for some reason by now you still don’t know where that is, open Thunar and click on View>Show Hidden Files :

Relog and open your terminal, you should see now that your URxvt has somehow became beautiful to the naked eye. Pat on the back. Now to slap neofetch into the terminal you need to add this line in your .bashrc file, which is located in your home directory (If for some strange reason you have skipped all my previous steps, go back and read them you wierdo)(again if this file doesn't exist make a new one and call it .bashrc):

neofetch --w3m $HOME/path/to/image/or/no/path/if/you/like/the/ascii/logo/art

[STEP 6]

Now for the final steps, as of this point you can decide to either do whatever you want, or you can follow the dark path of darkness you have stepped in (there are cookies in the dark side). You can copy my bspwmrc and sxhkd files or look at it and pick out things you want to take out, whatever you choose, the choice is up to you:

Likewise for my sxhkdrc file, the extra stuff is for volume, brightness, and scrot:

[STEP 7]

Now for polybar, polybar is a very complicated bar...just like every bar used for tiling window managers, but this one is complicated in the sense that nobody can hold your hand for it if things go wrong...just like every bar. The way polybar works is it is run by the almighty power of shell scripts and one configuration file, since you have already installed it why not start reading the basics from the wiki:

The configuration that is run in the example is so poorly written and personally I really hate it. It’s full of comments and shows that jaagr doesn’t know how to section his codeblocks carefully, which often throws users down the toilet upon first touching polybar. The way this works is that the example generates a config file in a folder called polybar in your hidden .config folder, delete it and instead open three new files for editing on an editor of your choice being run from the dmenu or run from any keybinds you have modified in sxkhdrc, and open up three more text files, and add/save these files into ~/.config/polybar/ :

config (Replace labels with awesome font Icons at your own risk: ):

Then chmod the shell scripts into executables [$chmod +x], and now upon relogging you should see the polybar appear. I’ve gone ahead and made the config file easier to read, to know more about how each of the modules work consult the polybar wiki. I’ve also used only two fonts which we installed earlier to serve as an example, and they are Font Awesome and Unifont.

To get the right colors based on your picture you have to use a color picker we installed earlier called gpick, you can run it from your dmenu, and in it select Tools>Pallette From Image to get your desired colors or use the picker option located in the lower right hand corner of the program. I’ve also purposely left out one module from the bar and it’s the compton module. Challenge yourself and figure out how to get it working. Also if you are ballsy enough, challenge yourself to get this just for practice:

Also to step up your rice level I challenge you to use the rEFInd bootloader, I've left a couple of links below to help out, and something to note is that it gets installed into /boot/EFI/ :

And to top it off use lightdm-gtk-greeter-settings to get your lightdm looking sharp. Voila, you have created a masterpiece.

[ Step 8 ]

I've included this extra step strictly for SX readers, and basically there is a way to turn your machine into a kali-like machine. The way you do this is you mount the BlackArch repo; BlackArch is a pentesting OS, very much like Kali, the only downside to BlackArch is that they still have a lot of tools in their Repo that aren't supported, so installing all of them is not the best idea. Instead what I recommend is you just just keep it in your system and grab what you need. Here's the commands on layering it on top of your Arch Linux installation:

# Run strapper as root and follow the instructions. (Run without <cite> tag)
$ curl -O <cite>

# The SHA1 sum should match
$ sha1sum

# Set execute bit
$ chmod +x

# Run
$ sudo ./

And to install packages:

# To list all of the available tools, run
$ sudo pacman -Sgg | grep blackarch | cut -d' ' -f2 | sort -u

# To install all of the tools, run [USE AT OWN RISK]
$ sudo pacman -S blackarch

# To install a category of tools, run [USE AT OWN RISK]
$ sudo pacman -S blackarch-<category>

# To see the blackarch categories, run
$ sudo pacman -Sg | grep blackarch

"This is our world now... the world of the electron and the switch, the
beauty of the baud."
-The Mentor