How to setup Openbox with shortcuts

Ryan De Vogel
4 min readOct 19, 2021

In this article I will give an explanation about how to configure Openbox in Linux. This is for beginners who started out and are a bit lost.

What is Openbox?

Openbox is a lightweight and free window manager for Unix-like operating systems including Linux, BSD and Solaris. Openbox can be used in conjunction with the desktop environments LXDE, GNOME and KDE. However, it can also be used separately. This is done in ArchBang, among others. Reference Wikipedia

How to setup?

Step 1 — download packages:

Debian based:

$ sudo apt install openbox tint2 obconf feh

Arch based:

$ sudo pacman -S openbox tint2 obconf feh

Step 2 — logout:

log out of your system and choose openbox

Ubuntu:

Manjaro:

After you have logged in to openbox you should see a black background like this:

(right click for basic menu)

Don’t be scared it is completely normal. The reason is that Openbox doesn’t draw the wallpaper and it doesn’t have a taskbar. We have already downloaded other packages for this.

Step 3 — autostart:

Let’s start configuring autostartup. So first in your ~/.config folder make a folder named openbox. Inside the folder we just created we now make a file named ‘autostart’.

Now put this text inside the autostart file:

tint2 &
feh --bg-scale /path-to-image

tint2 is your taskbar and feh is for drawing a wallpaper. Now reconfigure by right clicking anywhere and press ‘reconfigure’ after that log out and log back in. Now you should have a taskbar and a wallpaper.

Step 4 — configure shortcuts:

Now your Openbox config folder should look something like this. The rc.xml should be generated by openbox when you reconfigured.

So now let’s edit the rc.xml file and go the the ‘keybinding for running applications’ section.

(I already added custom shortcuts in this)

You will see that a shortcut to execute something is constructed like this:

<keybind key=”A-f”>
<action name=”Execute”>
<command>firefox</command>
</action>
</keybind>

This will open firefox when you press alt + f.

Keep these keys in mind:

S — Shift key

C — Control key

A — Alt key

W — Super key (Usually bound to the Windows key on keyboards which have one)

M — Meta key

H — Hyper key (If it is bound to something)

So now we know this we can start combining these:

<keybind key=”A-Return”>
<action name=”Execute”>
<command>terminator</command>
</action>
</keybind>

This will open terminator when you press alt + return.

<keybind key=”S-A-d”>
<action name=”Execute”>
<command>Thunar</command>
</action>
</keybind>

This will open Thunar when you press shift + alt + d.

We can also close the current app if we like:

<keybind key=”A-q”>
<action name=”Close”>
</action>
</keybind>

Note: here we use Close instead of execute.

You can also run rofi with this:

<keybind key=”A-d”>
<action name=”Execute”>
<command>rofi -show run</command>
</action>
</keybind>

If we want we can also manage windows:

<keybind key=”A-m”>
<action name=”ToggleMaximize”>
</action>
</keybind>

This will toggle maximize the current screen.

Note: here we use ToggleMaximize instead of execute.

If you want you can maximize, but only in one direction:

<keybind key=”A-m”>
<action name=”ToggleMaximize”><direction>horizontal</direction>
</action>
</keybind>

This will stretch it only horizontal.

You can also adjust sound if you have amixer:

<keybind key=”XF86AudioRaiseVolume”>
<action name=”Execute”>
<command> amixer set Master 10%+</command>
</action>
</keybind>

<keybind key=”XF86AudioLowerVolume”>
<action name=”Execute”>
<command> amixer set Master 10%-</command>
</action>
</keybind>

<keybind key=”XF86AudioMute”>
<action name=”Execute”>
<command> amixer set Master toggle</command>
</action>
</keybind>

These are the tags that you would use to make the sound lower, higher and mute it.

You can find my rc.xml on github.

I hope it helps and thanks for reading my article.

--

--