Roll your own Linux desktop using Openbox

Last updated on 2021-03-02 Tagged under  # linux

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 laptop running Debian.


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/

Install custom desktop extras ...

$ sudo apt install diodon dunst dbus-x11 feh hsetroot i3lock libnotify-bin network-manager network-manager-gnome pavucontrol pmount pulseaudio-utils rofi rxvt-unicode scrot tint2 viewnior volumeicon-alsa xfce4-power-manager
$ sudo apt install gnome-themes-standard gtk2-engines-murrine gtk2-engines-pixbuf fonts-dejavu fonts-firacode fonts-liberation2 fonts-ubuntu adwaita-qt qt5-style-plugins lxappearance papirus-icon-theme

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

exec openbox-session

... save, run startx, and behold ...


Hmm ... out-of-box Openbox is a grey blank canvas just begging for some love!

Config: rc.xml

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

* Add desktops

I have Openbox create four desktops at launch ...


* Keybindings

I create hotkey keybindings that perform a range of actions: switch desktops, move windows, launch menus, lock/suspend/exit the system.

* Decorations

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">


* Lock screen

I use i3lock launched from a keybinding (windows key + l) to lock my screen, or to work in concert with systemctl to lock screen when suspend (windows key + s) is activated. Set a custom lockscreen image in ~/.i3lock.png. Add to rc.xml ...

    <!-- Keybindings for [l]ock screen, [s]uspend, [e]xit -->
    <keybind key="W-l">
      <action name="Execute">
        <command>i3lock -c 000000 -i ~/.i3lock.png</command>
    <keybind key="W-s">
      <action name="Execute">
        <command>sh -c 'i3lock -c 000000 -i ~/.i3lock.png; sync; systemctl suspend'</command>

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 viewnior to display it. Add some screenshot options to menu.xml ...

<menu id="scrot-menu" label="Screenshots">
<item label="Now">
    <action name="Execute"><execute>
        scrot -d 1 -u -z 'screenshot-%Y-%m-%dT%H%M%S.png' -e 'mv $f ~/image/screenshot &amp; viewnior ~/image/screenshot/$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 ~/image/screenshot &amp; viewnior ~/image/screenshot/$f'
<item label="Selected Area...">
    <action name="Execute"><execute>
        scrot -s 'screenshot-%Y-%m-%dT%H%M%S.png' -e 'mv $f ~/image/screenshot &amp; viewnior ~/image/screenshot/$f'
<item label="Desktop">
    <action name="Execute"><execute>
        scrot 'screenshot-%Y-%m-%dT%H%M%S.png' -e 'mv $f ~/image/screenshot &amp; viewnior ~/image/screenshot/$f'

Result ...


Launch applications

For choosing and launching applications I use rofi, a dynamic applications menu utility. I set a keybinding in rc.xml (windows key + spacebar) that launches an applications menubar across the top of the display and, as I type the name of the application, the menu zooms in on matching names. Most frequently-used applications rise to the beginning of the list for quick access.

Menu behaviour and appearance can be modified in ~/.config/rofi.

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.

Config: autostart

Actions and applications to be launched when starting Openbox are configured in ~/.config/openbox/autostart.

* Background

I use hsetroot to set the background colour, and the feh image viewer to set a background image for the desktop ...

$ 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) &

* 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 &

* Power management

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

xfce4-power-manager &

* Notifications

Dunst is a lightweight notification daemon for desktop events. Configure the daemon in ~/.config/dunst/dunstrc. Add entry to autostart ...

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

* Panel

I use tint2 as my desktop panel. Highly configurable with few dependencies. Provides items like a taskbar, system tray, battery indicator, and clock. Configuration is set in ~/.config/tint2/tint2rc. My own config was inspired by these colourful samples. Add entry to autostart ...

tint2 &

* Clipboard

Desktop clipboard clipit for multiple-entry copy-paste operations. Add entry to autostart ...

clipit &

* Volume control

Volumeicon-alsa places a volume icon in the system tray. Add entry to autostart ...

volumeicon &

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

* 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. 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 ...

$ sudo systemctl restart network-manager

Add entry to autostart ...

nm-applet &


Style the desktop with a combination of themes, colours, icons, and fonts. I like the Nord colour pallete.


Create ~/.themes ...

$ mkdir ~/.themes

Download the Nordic theme, unzip, and copy Nordic-master to ~/.themes/Nordic. Select using the lxappearance utility. Pairs nicely with Papirus Dark icon set.

* Openbox

Download the Nord Openbox theme, unpack, and copy to ~/.themes/. Select using the obconf utility.

* QT

Use qt5-style-plugins to style QT apps with the chosen GTK theme. Add entry to ~/.profile ...


* Terminal

I use urxvt as my terminal with Fira Code fonts and Nord-inspired colours. Configuration is set in ~/.Xresources.

End result

From grey screen to the good stuff ...


» Later: Secure remote access using SSH keys

« Earlier: Virtualbox on Debian Buster