Installing BSPWM on Debian
How to install BSPWM, a dynamic tiling window manager
The following setup is crafted to fit my needs, and have been inspired by multiple /r/unixporn rices. This configuration relies on MX Linux 21 XFCE.
Start your journey:
> sudo apt install bspwm sxhkd polybar compton rofi dunst nitrogen i3lock redshift cmus ranger
First thing: DO NOT START BSPWM. Copy the example configuration to your
~/.config folder
and make surebspwmrc
is executable :
> cd ~/.config/ && mkdir -p bspwm sxhkd
> cp /usr/share/doc/bspwm/examples/bspwmrc ~/.config/bspwm/
> cp /usr/share/doc/bspwm/examples/sxhkdrc ~/.config/sxhkd/
> chmod u+x ~/.config/bspwm/bspwmrc
Notice that Bspwm uses two config files:
bspwmrc
that start programs and defines your WM rulessxhkdrc
that handles keyboard shortcuts
So take the time to configure your settings before running your BSPWM session!
Keybindings: sxhkdrc
Check the config file, learn/modify the keybindings to your liking:
> vim ~/.config/sxhkd/sxhkdrc
Basic shortcuts (not all default):
Super + d: rofi
Super + Return: terminal
Super + Shift + return: floating terminal
Super + {1–9}: go to ws
Super + Ctrl + {Left, Right}: go to ws
Super + Shift + {1–9}: move window to ws
Super + f: floating
Super + w: monocle
Super + q: close window
Super + Shift + q: quit wm
Super + l: session menu
Super + Esc: reload sxhkd
Super + Alt + e: reload bspwm
Config file: bspwmrc
Check the config file:
> vim ~/.config/bspwm/bspwmrc
Declare the apps to autostart when launching a session:
- make sure
sxhkdrc
is launched at start:pgrep -x sxhkd > /dev/null || sxhkd &
- compositing manager:
compton --backend glx --vsync opengl-swc &
- polkit
usr/lib/xfce-polkit/xfce-polkit &
- bar (here polybar, throught a script):
~/bin/polybar.launch.sh &
- wallpaper:
nitrogen --restore &
Then specify windows and workspaces rules . When settings rules you may need to check programs name/label/class with xprop
.
Bar: polybar
We won’t use the default bspwm bar, but Polybar: highy customizable and documented. And fully compatible with bspwm.
> mkdir ~/.config/polybar
> cp /etc/polybar/config.ini ~/.config/polybar/
> vim ~/.config/polybar/config
We start Polybar through a script referenced in bspwmrc
:
#!/usr/bin/env sh# Terminate already running bar instances
killall -q polybar# Wait until the processes have been shut down
while pgrep -x polybar >/dev/null; do sleep 1; done# Launch: 'top' is the name of my Polybar
polybar &
Done, now it’s time to work on the config file.
Install a NerdFont to display icons on your bar:
> wget https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/JetBrainsMono.zip
dtrx JetBrainsMono.zip
> sudo cp -avr JetBrainsMono/ /usr/share/fonts/truetype/
> fc-cache -f -v
> rm JetBrainsMono.zip
Compositor: compton
I’ve tried a few compositor, mostly forks of Picom adding blur, rounded corners and animations. Heavy on CPU, mostly work in progress, sometimes impressive, but in the end an optimized compton.conf
is the best solution.
# shorter shadows
shadow-radius = 5;
shadow-offset-x = -5;
shadow-offset-y = -5;
shadow-opacity = 0.8;# faster animations
fade-in-step = 0.07;
fade-out-step = 0.07;
Launcher: rofi
Rofi is a fantastic customizable launcher for Linux, we use it instead of dmenu and to manage additional menus such as Session menu.
To launch Rofi open a terminal and enter: rofi -show drun
This will launch Rofi in desktop run mode: it allows users to quickly search and launch an application from the freedesktop.org Desktop Entries. These are used by most Desktop Environments to populate launchers and menus. Drun mode features:
- favorites list, with frequently used programs sorted on top
- auto starting terminal applications in a terminal
Rofi config file is in: ~/.config/rofi/config.rasi
. You may compose multiple themes and call them in CLI: rofi -shwo drun -theme path/to/file.rasi
I'm using this option for bspwm session menu.
ScreenLocker: i3lock
Fantastic screenlocker, to use as it is, and before suspending your machine. It only takes PNG files as background image.
- lock:
i3lock --image ~/Pictures/Backgrounds/lock.png
- lock & suspend:
i3lock --image ~/Pictures/Backgrounds/lock.png && sudo pm-suspend
Have fun!
Sources
- Reddit: /r/unixporn
- polybar scripts: https://github.com/polybar/polybar-scripts/tree/master/polybar-scripts
- Arcolinux Config: https://www.arcolinuxd.com/bspwm/
- Azerty keyboards setup: https://www.arcolinuxd.com/4-change-bspwm-from-qwerty-to-azerty-keyboard/
- Polybar “The Linux Cast”: https://www.youtube.com/watch?v=tOBDUBEMAKM
- Polybar “Eric Murphy”: https://www.youtube.com/watch?v=S1jQfGcKjtA
- Blog post: https://dev.to/l04db4l4nc3r/bspwm-a-bare-bones-window-manager-44di#some-shortcomings