bspwm

From Gentoo Wiki
Jump to: navigation, search

bspwm is a lightweight, tiling, minimalist window manager that is written in C and represents its windows as leaves on a binary tree. Its installed size is less than 600 KB (even with the examples USE flag enabled). It only responds to X events and messages it receives on a dedicated socket from a program included in its package, bspc.

Installation

USE flags

USE flags for x11-wm/bspwm Tiling window manager based on binary space partitioning

Emerge

To install bspwm using Portage merely issue the command:

root #emerge --ask x11-wm/bspwm

sxhkd is used for keybindings and pointer bindings so one may wish to install it too with:

root #emerge --ask x11-misc/sxhkd

Configuration

If you installed with examples local USE flag enabled, you have to configure bspwm properly.

First create the necessary directories that will hold your configurations. Because bspwm doesn't handle keyboard or pointer inputs, it's using x11-misc/sxhkd (Simple X hotkey daemon) to do so, therefore we'll need a config file for that as well because that's where all your key bindings will reside.

user $mkdir -vp ~/.config/bspwm ~/.config/sxhkd

Now copy the sample configuration files from /usr/share/doc/bspwm/examples/ and, if required, extract them:

user $cp -v /usr/share/doc/bspwm/examples/bspwmrc.bz2 ~/.config/bspwm/
user $cp -v /usr/share/doc/bspwm/examples/sxhkdrc.bz2 ~/.config/sxhkd/
user ~/.config/bspwm $bunzip2 bspwmrc.bz2
user ~/.config/sxhkd $bunzip2 sxhkdrc.bz2
Note
The bspwmrc configuration file needs to be executable. Therefore, if it's not, you can chmod +x ~/.config/bspwm/bspwmrc.

Autostart programs

If you have certain programs that want to start after logging in on the workstation (i.e. net-misc/dropbox, media-gfx/feh) you can achieve that by simply adding them in the bspwm config file

FILE ~/.config/bspwm/bspwmrcbspwm configuration file
# autostart programs
dropbox
feh --bg-scale ~/.config/my_wallpaper.png
${HOME}/.config/polybar/launch.sh

Hide/Show windows

Some programs also have tray icons and one may want to mimic the Minimize behavior (hide in the bspwm world), you can achieve that by setting a keyboard shortcut. Note that when restoring them, they will spawn in the same Monitor that they were hidden, just so you don't go look for them in the other Desktops randomly...

FILE ~/.config/sxhkd/sxhkdrcsxhkd configuration file
# hide window
super + v
  bspc node -g hidden

# unhide window
super + shift + v
  bspc node {,$(bspc query -N -n .hidden | tail -n1)} -g hidden=off

Additional software

dmenu

In order to launch whatever programs you desire

USE flags for x11-misc/dmenu a generic, highly customizable, and efficient menu for the X Window System

savedconfig Use this to restore your config from /etc/portage/savedconfig ${CATEGORY}/${PN}. Make sure your USE flags allow for appropriate dependencies
xinerama Add support for querying multi-monitor screen geometry through the Xinerama API

To assign a keyboard shortcut for launching dmenu:

FILE ~/.config/sxhkd/sxhkdrcsxhkd configuration file
# program launcher
super + @space
  dmenu_run

Terminal emulators

st aka suckless/simple terminal

If lightweight is how you roll, this might be of use

Cannot load package information. Is the atom x11-terms/st correct?

To install it, just issue the command:

root #emerge --ask x11-terms/st

To enable a keyboard shortcut for launching the terminal

FILE ~/.config/sxhkd/sxhkdrcsxhkd configuration file
# terminal emulator
super + Return
  st

rxvt-unicode aka urxvt

This is another alternative, although it lacks full unicode support and you might have some issues with Powerline Fonts.

Cannot load package information. Is the atom x11-terms/rxvt-unicode correct?

You can install it issuing the command:

root #emerge --ask x11-terms/rxvt-unicode

i3lock

Locking your screen is always recommended in order to avoid unauthorized access to your Workstation

USE flags for x11-misc/i3lock Simple screen locker

You can install it by issuing the command:

root #emerge --ask x11-misc/i3lock

In order to assign a keyboard shortcut for locking your screen, you should update your configuration file

FILE ~/.config/sxhkd/sxhkdrcsxhkd configuration file
# lock the screen with dark background
super + q
  i3lock -c 000000

File managers

ranger

ranger is a console file manager with VI key bindings. It provides a minimalistic and nice curses interface with a view on the directory hierarchy. It ships with rifle, a file launcher that is good at automatically finding out which program to use for what file type.

You can install ranger via

root #emerge --ask app-misc/ranger

If you want to tune ranger with your own settings:

Start ranger and exit so that it creates the directory structure for its configuration files.

user $ranger
user $Q

Now copy the configuration files:

user $ranger --copy-config=all
creating: /home/user/.config/ranger/apps.py
creating: /home/user/.config/ranger/commands.py
creating: /home/user/.config/ranger/rc.conf
creating: /home/user/.config/ranger/options.py
creating: /home/user/.config/ranger/scope.sh

See also

External resources