Your Guide to a Comfortable Linux Desktop With Openbox

Robert Washbourne - 3 years ago - desktop environments, themes

Openbox is a lightweight linux stacking desktop environment that is configured with files. Openbox is a cross between a completly minimal desktop such as i3wm, and a full blown desktop like GNOME or KDE. This allows for a large variety of configurations, and more control for the user.

Openbox is configured using 3 files: Openbox autostart, Openbox RC, and Openbox menu. (These can be found in ~/.config/openbox/ .) The autostart file controls what application are started with Openbox, the RC controls the bulk of the settings, such as the window layout, the theme, and all keyboard shortcuts, and the menu file controls the right click menu.

Openbox users typically use the Tint2 panel, which is shown with my configuration in the screenshot above. However, other panels, or bars, can be used, and I have a small list of them on my i3wm post. However, in this post I will only show tips about Tint2.

Installation

If you are on Ubuntu, you can install with

sudo apt-get install openbox obconf

and switch to Openbox with the button below. (Image from howtogeek)

On Arch linux, you can install with

sudo pacman -S openbox

And switch using your display manager or with startx.

On other distros, Google it; the information should be there.

Autostart

This is pretty simple. Just add the commands you want to run on each line, but remember to end them with a & so they become their own process. For example:

nitrogen --restore & #restore the background chosen with nitrogen lxpolkit & #polkit (password popup) clipit & #a tray clipboard manager compton & #the compositor tint2 & #the panel pamac-tray & #pamac software installer updates checker xautolock -time 15 -locker "~/lock.sh" -notify 30 -notifier "notify-send -u critical -t 10000 -- 'Locking screen in 30 seconds'" & #locks screen after 30 mins

The ~/lock.sh above is a simple script to take a screenshot, blur it, and run i3lock with the image. Here it is if you're interested.

Openbox RC

This one is a tad bit more complicated. However, we will go over the basics. In most cases, the default RC should be good enough, but you can edit it to change your theme and add keyboard shortcuts.

Themes

Openbox window themes can be changed from the RC. First, you should download a theme or two. Openbox has a list of where you can get some, or you can use Arc-Box theme which matches the Arc GTK theme. This is shown in my top screenshot.

The title layout controls the close/minimize/maximise buttons and the window title.

<theme> <name>Arcbox</name> <titleLayout>LIMC</titleLayout> <!-- available characters are NDSLIMC, each can occur at most once. N: window icon L: window label (AKA title). I: iconify M: maximize C: close S: shade (roll up/down) D: omnipresent (on all desktops). --> <keepBorder>yes</keepBorder> <animateIconify>yes</animateIconify> </theme>

Keyboard shortcuts

I've copied the excellent cheat sheet from daveden's wordpress post here for the defaults:

Action Binding Go to desktop (direction) ctrl + alt + arrow Go to desktop (number) super + f1/f2/f3/f4 Send to desktop shift + alt + arrow Toggle show desktop super + d Close window alt + f4 Hide window alt + esc Window menu alt + space Next window alt + tab Previous window alt + shift + tab Go to window (direction) super + shift + arrow Toggle fullscreen f11

Here are a few shortcuts I like to add myself:

<keybind key="XF86MonBrightnessUp"> <action name="Execute"> <command>xbacklight +10</command> </action> </keybind> <keybind key="XF86MonBrightnessDown"> <action name="Execute"> <command>xbacklight -10</command> </action> </keybind> <keybind key="C-A-L"> <action name="Execute"> <command>~/lock.sh</command> </action> </keybind> <keybind key="C-A-t"> <action name="Execute"> <command>termite</command> </action> </keybind> <keybind key="XF86AudioRaiseVolume"> <action name="Execute"> <command>sh -c "pactl set-sink-mute 0 false ; pactl set-sink-volume 0 +5%"</command> </action> </keybind> <keybind key="XF86AudioLowerVolume"> <action name="Execute"> <command>sh -c "pactl set-sink-mute 0 false ; pactl set-sink-volume 0 -5%"</command> </action> </keybind> <keybind key="XF86AudioMute"> <action name="Execute"> <command>sh -c "pactl set-sink-mute 0 true ; pactl set-sink-volume 0 0%"</command> </action> </keybind> <keybind key="Super_L"> <action name="Execute"> <name>dmenu</name> <command>rofi -show drun -font "SFNS Display 18" -terminal termite</command> </action> </keybind>

The first two change the brightness, the rest change the volume, and the last opens rofi (a application search) on the super key. If you want to open apps with rofi as well, first download it from your distro's package manager and then copy my config to your .Xresources for the arc colors:

You can switch tabs in rofi with Shift+Arrow Keys . This is my current and favorite config for rofi, and it matches pretty well with the Arc theme, but many others can be found on /r/unixporn.

Openbox Menu

The menu also uses xml for config. You can generate this dynamically or statically to get a list of applications in categories like the picture below using obmenu-generator.

To get this, install obmenu generator and edit your menu file. It should look like this (the -i adds icons):

<?xml version="1.0" encoding="utf-8"?> <openbox_menu xmlns="http://openbox.org/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://openbox.org/"> <menu id="root-menu" label="obmenu-generator" execute="/usr/bin/perl /usr/bin/obmenu-generator -i" /> </openbox_menu>

If you prefer to customize the menu or use a faster static version (will not update when you install new apps) you can run obmenu-generator and customize the output.

GUI settings

If you're more of a graphical person, Obconf has you covered. This should have been installed with Openbox. Obconf can change most things in the RC file, but not autostart or keyboard shortcuts.

Matching Chrome

If you would like to match Chrome to Arcbox colors, you can use the colors #2F343F and #404552 .

Here is the Chrome theme I made (crx file).

I am using a chrome extension I made (Start Clean New Tab Page: with search, without search).

Tint2

Tint2 can be configured with Tint2conf which is installed with Tint2. If you would like my config, you can edit ~/.config/tint2/tint2rc with the contents of my gist.

The small black square shows that there is no music playing. The music indicator is powered by spotify-now . Here is the command:

{ echo "$(spotify-now -i " <b>%title" -e "<b>" -p " paused<b>" | awk -v len=40 '{ if (length($0) > len) print substr($0, 1, len-3) "..."; else print; }' | tr -d '&' | awk '{print $0 "</b>"}')"; echo "$(spotify-now -i '%artist' -p ' ' -e ' ')"; } | tr "

" " "

The font awesome font should be installed for the same look. Here is what music playing looks like (long titles are shortened with ellipses, use pango markup with an executor in tint2):

There are many more great Tint2 themes, a great place to look is /r/unixporn (again).

Finishing up

I hope you like Openbox! If you want more info, the Arch Wiki page on Openbox is a great resource.

The Openbox website

Here is my current screenshot (wall is snow peaks by Luan Nguyen):



