locxter.net

Integrating BSPWM with XFCE4 for the perfect DE/WM setup

2023-03-19

When getting into the Linux world, every newbie is inevitably confronted with a plethora of choice regarding a distribution's release model, package manager and - probably most important for daily use - desktop environment or window manager (DE or WM for short). So what's the perfect setup? Well, in this article I want to present my somewhat unusual, but honestly amazing choice of integrating BSPWM with XFCE4...

Before we talk about what makes this specific combination so awesome, we should first understand which jobs a DE/WM has and what diffentiates the two. In a nutshell, a DE or WM is responsible for controlling the placement and appearance of graphical windows by providing them with an area to draw within and forwarding user interactions like quit requests issued via graphical buttons or keyboard shortcuts. Whereas a window manager aims to be simple and follow the UNIX philosophy by doing only this one thing, but doing it well, a desktop environment is a collection of several components usually including a window manager, task bar (with tray and application launcher), wallpaper engine as well as integrated applications and utilities (e. g. for network, bluetooth and display configuration).

Personally, I really like the idea of tiling WMs due to their simplicity and productivity, since you do not have to think about window managment too much yourself, they force you to organize your windows in different workspaces and therefore overall embrace structuring you work. However, they really are quite minimal by design and therefore somewhat inconvenient to use standalone, which is where the integration with DEs comes into play.

I selected XFCE4, because it is lightweight as well as very modular and therefore quite easily allows you to replace its default window manager XFWM4 with something else, and BSPWM, which is not the most popular, but a very capable and modular WM with very comfortable defaults. The specialties of BSPWM include support of gaps between windows, spiral window ordering and the lack of an integrated status bar as well as keyboard deamon, which makes it the perfect fit for my case.

In order to integrate BSPWM with XFCE4, you simply have to follow these steps:

  1. Deactivate XFWM4 and start BSPWM instead by running: xfconf-query -c xfce4-session -p /sessions/Failsafe/Client0_Command -t string -sa xfsettingsd && xfconf-query -c xfce4-session -p /sessions/Failsafe/Client1_Command -t string -sa xfdesktop && xfconf-query -c xfce4-session -p /sessions/Failsafe/Client2_Command -t string -sa xfce4-panel && xfconf-query -c xfce4-session -p /sessions/Failsafe/Client3_Command -t string -sa bspwm
  2. Remove all keyboard shortcuts from the XFCE settings and use sxhkd as a keyboard daemon instead. Alternatively, add all the necessary shortcuts to the integrated XFCE daemon - take a look at xfce4-keyboard-shortcuts.xml in xfce4-config.zip of my personal setup script , but keep in mind that it is customized to the German keyboard layout.
  3. Add the line bspc rule -a Wrapper-2.0 monitor=primary follow=on state=floating border=off rectangle=500x600+0+0 to your bspwmrc in order to properly show the Whisker menu.
  4. If you use Java applications and they don't work properly, create a script java-fix.sh inside /etc/profile.d/ with the following content:
    #!/bin/bash
    export _JAVA_AWT_WM_NONREPARENTING=1
    export AWT_TOOLKIT=MToolkit
    export JAVA_TOOL_OPTIONS="-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel -Dswing.crossplatformlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel"
    export JDK_JAVA_OPTIONS="-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel -Dswing.crossplatformlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel"
    export _JAVA_OPTIONS="-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel -Dswing.crossplatformlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel"
  5. Configure XFCE4 just like you would do in any other setup and enjoy your new config.

For me at least, this setup really made me love my computer even more and helped structure my workflows better. If you have any advices to make it still better, feel free to post them in the comments...

RSS feed