Roll your own Linux desktop using Openbox

Last modified on 2019-04-10

A window manager like Openbox handles the “drawing” of windows on a display, and typically run underneath heavier full-desktop X environments. However - given a few tweaks, add a few applications, and a fresh splash of “paint” (themes) - Openbox can run in standalone mode and makes an excellent foundation for a custom lightweight and delightful Linux desktop!

Let’s go!

I start with a bare display and pick and choose components to make a desktop just the way I like it. Some advantages of a self-assembled Openbox desktop:

Setup is done on my Acer Chromebook running Debian testing aka “buster” release.

0. Install

Install Openbox and copy default config files to $HOME

$ sudo apt install openbox obconf menu
$ mkdir -p ~/.config/openbox
$ cp /etc/xdg/openbox/* ~/.config/openbox/

My default mode is to login via console, then run startx to launch an X environment. Add openbox-session to ~/.xinitrc

exec openbox-session



Ladies and gentleman, I present a screenshot of an out-of-box Openbox session. Grey never looked so good! 🐧

But let’s make some changes nonetheless …

1. Config: rc.xml

Most of the desktop configuration details for the user are set in ~/.config/openbox/rc.xml.

1.1 Desktops

At startup create four desktops …


1.2 Keybindings

I create keybindings that perform a range of actions: switch desktops, move windows, launch menus, lock and suspend system …

Keybindings for desktop

Alt+1        goto desktop 1
Alt+2        goto desktop 2
Alt+3        goto desktop 3
Alt+4        goto desktop 4
Alt+d        toggle show desktop

    <keybind key="A-1">
      <action name="GoToDesktop">


    <keybind key="A-d">
      <action name="ToggleShowDesktop"/>

Keybindings for windows

Shift+Alt+1        send window to desktop 1
Shift+Alt+2        send window to desktop 2
Shift+Alt+3        send window to desktop 3
Shift+Alt+4        send window to desktop 4
Shift+Alt+Down        send window to monitor 2
Shift+Alt+Up        send window to monitor 1
Shift+Alt+Left        resize window to left half of screen
Shift+Alt+Right        resize window to right half of screen
Shift+Alt+d        toggle decorations
Shift+Alt+c        close window

<keybind key="S-A-1">
    <action name="SendToDesktop">


<keybind key="S-A-Up">
    <action name="MoveResizeTo">
<keybind key="S-A-Down">
    <action name="MoveResizeTo">
<keybind key="S-A-Left">
    <action name="UnmaximizeFull"/>
    <action name="MoveResizeTo">
<keybind key="S-A-Right">
    <action name="UnmaximizeFull"/>
    <action name="MoveResizeTo">
<keybind key="S-A-d">
    <action name="ToggleDecorations"/>
<keybind key="S-A-c">
    <action name="Close"/>

Link: Keybind to split screen in 2 windows

Keybindings for window switching

Alt+Tab        switch between windows on current desktop
Shift+Alt+Tab        switch between windows on all desktops

<keybind key="A-Tab">
    <action name="NextWindow">
    <action name="Focus"/>
    <action name="Raise"/>
    <action name="Unshade"/>
<keybind key="S-A-Tab">
    <action name="NextWindow">
    <action name="Focus"/>
    <action name="Raise"/>
    <action name="Unshade"/>

Keybindings to launch applications

Alt+F2        run applications menu (rofi)
Alt+F1        root menu

<keybind key="A-F2">
    <action name="Execute">
        <command>rofi -monitor primary -show run</command>
<keybind key="A-F1">
    <action name="ShowMenu">

Keybindings for [l]ock screen, [s]uspend, [e]xit

Ctrl+Shift+l        lock screen
Ctrl+Shift+s        suspend
Ctrl+Shift+e        exit to console

<keybind key="C-A-l">
    <action name="Execute">
        <command>i3lock -c 000000 -i ~/.i3lock.png</command>
<keybind key="C-A-s">
    <action name="Execute">
        <command>sh -c 'i3lock -c 000000 -i ~/.i3lock.png; sync; systemctl suspend'</command>
<keybind key="C-A-e">
    <action name="Exit">

1.3 Applications

Set default condition that matches all application windows and maximize + remove decorations when launched. Leave things like dialog windows or panels untouched …

<application type="normal">

… except for VLC media player …

<application class="vlc">

Links: 1/ Launching windows maximized; 2/ Finding parameters

2. Config: menu.xml

Openbox includes a system menu that appears on a right-click on the desktop. Modifications go in ~/.config/openbox/menu.xml.

Example: I add a screenshot sub-menu that calls on scrot to capture the image and mirage viewer to display it. First, install these programs …

$ sudo apt install scrot mirage

… then add some screenshot options to menu.xml

<menu id="scrot-menu" label="Screenshots">
<item label="Now">
    <action name="Execute"><execute>
    scrot -u -z 'screenshot-%Y-%m-%dT%H%M%S.png' -e 'mv $f ~/Downloads/ &amp; mirage ~/Downloads/$f'
<item label="In 5 Seconds...">
    <action name="Execute"><execute>
    scrot -d 5 -u -z 'screenshot-%Y-%m-%dT%H%M%S.png' -e 'mv $f ~/Downloads/ &amp; mirage ~/Downloads/$f'
<item label="Selected Area...">
    <action name="Execute"><execute>
    scrot -s 'screenshot-%Y-%m-%dT%H%M%S.png' -e 'mv $f ~/Downloads/ &amp; mirage ~/Downloads/$f'
<item label="Desktop">
    <action name="Execute"><execute>
    scrot 'screenshot-%Y-%m-%dT%H%M%S.png' -e 'mv $f ~/Downloads/ &amp; mirage ~/Downloads/$f'

Result …


2.1 Dynamic applications menu

For choosing and launching applications I don’t use the main menu or click on icons, but rely instead on the excellent rofi dynamic applications menu. Dynamic in the sense of using a hotkey combo (see above) to open the menu of all apps available, and as I type the menu narrows the list of matching apps. Most frequently-used apps rise to the top of the list for quick access.

Install …

$ sudo apt install rofi

Menu behaviour and appearance can be modified in ~/.Xresources.


3. Config: environment

Set user-specific environment variables in ~/.config/openbox/environment. I don’t use it myself because most of the relevant settings are configured elsewhere. But if I wanted to configure something to be Openbox-specific this is probably a good place to do so.

4. Config: autostart + Applications

Actions to be done at startup are configured in ~/.config/openbox/autostart.

4.1 Background

I use hsetroot (plays nice with compton - see below) to set the background colour, and the feh image viewer to set a background image for the desktop. Install and set image …

$ sudo apt install hsetroot feh
$ feh --bg-scale /path/to/your/background/image.jpg

Once an image is chosen, feh stores its name in ~/.fehbg. Add entry to autostart to restore the background on next launch …

hsetroot -solid "#000000"
(sleep 1; ~/.fehbg) &

4.2 Laptop + external display

I created a shell script to detect when my laptop is connected to an external display, and make that secondary (larger) display register as PRIMARY display (windows default to opening on PRIMARY).

Add entry to autostart

~/bin/dldsply -r &

4.3 Compositor

Compositing provides windows with an off-screen buffer to minimize screen distortions and artifacts on the desktop. Openbox does not include a built-in compositing manager. Install compton to serve in that role …

$ sudo apt install compton compton-conf

Add entry to autostart

compton -b -c &

4.4 Keyboard

I created another shell script that detects a few different keyboards I use (laptop keyboards, USB keyboard) and loads the appropriate xbindkeys + xmodmap config files for hotkey combos and key remappings.

Install …

$ sudo apt install xbindkeys x11-xserver-utils

Add entry to autostart

(sleep 5; ~/bin/keyboardconf) &

4.5 Power management

Use xfce4-power-manager to handle AC and battery power events, screen brightness, suspend system, suspend-on-lid-closure for laptops, etc. Install …

$ sudo apt install xfce4-power-manager

Add entry to autostart

xfce4-power-manager &

4.6 Notifications

Dunst is a lightweight notification daemon for desktop events. Install …

$ sudo apt install dunst dbus-x11 libnotify-bin

… and configure the daemon in ~/.config/dunst/dunstrc and ~/.Xresources.

Add entry to autostart

dunst -config ~/.config/dunst/dunstrc &

4.7 Panel

I use tint2 as my desktop panel. Highly configurable with few dependencies. Provides items like a taskbar, system tray, battery indicator, and clock. Install …

$ sudo apt install tint2

Configuration is set in ~/.config/tint2/tint2rc. My own config was inspired by these colourful samples.

Add entry to autostart

tint2 &

4.8 Clipboard

Desktop clipboard clipit for multiple-entry copy-paste operations. Install …

$ sudo apt install clipit

Add entry to autostart

clipit &

4.9 Volume control

I use a combination of tools to control volume on my laptop:

Install …

$ sudo apt install pulseaudio-utils volumeicon-alsa pavucontrol

Add entry to autostart

volumeicon &

Right-click on the volume icon, select Preferences, and change the external mixer to pavucontrol.

4.10 Network manager

Network-Manager is my choice to manage wired and wireless connections. Use nm-applet to place a network menu in the system tray. Install …

$ sudo apt install network-manager network-manager-gnome

An autostart desktop file in /etc/xdg/autostart/nm-applet.desktop launches nm-applet whenever an Openbox session begins.

Comment out and disable entries in /etc/network/interfaces for any network devices to be managed instead by network-manager

# The primary network interface
#allow-hotplug enp0s25
#iface enp0s25 inet dhcp

Restart network-manager

$ sudo systemctl restart network-manager

5. Lock screen

I use i3lock launched from a hotkey combo (see above) to lock my screen, or to work in concert with systemctl to lock screen when suspend is activated. Install …

$ sudo apt install i3lock

Set a custom lockscreen image in ~/.i3lock.png.

6. Themes

Style the desktop with a combination of themes, colours, icons, and fonts.

6.1 GTK2+3 + Openbox

I like the Shades-of-gray theme. Create ~/.themes

$ mkdir ~/.themes

… download some theme dependencies, Shades-of-gray, and install theme …

$ sudo apt install gnome-themes-standard gtk2-engines-murrine gtk2-engines-pixbuf
$ git clone
$ cp -r Shades-of-gray-theme/Shades-of-* ~/.themes

6.2 QT

Use qt5-style-plugins to style QT apps with the chosen GTK theme. Install …

$ sudo apt install qt5-style-plugins

Add entry to ~/.bashrc


6.3 Icons

I like the Suru++ icon set. Create ~/.icons

$ mkdir ~/.icons`

… download and install icon theme …

$ wget -qO- | env DESTDIR="$HOME/.icons" sh

6.4 Fonts

Install a few extra fonts …

$ sudo apt install fonts-dejavu fonts-liberation2 fonts-ubuntu

6.5 Configure utility

Use the lxappearance config utility to setup GTK2+3 and obconf to setup Openbox with the new theme. Install …

$ sudo apt install lxappearance obconf

7. My custom desktop

From grey screen to the good stuff …


Happy hacking!