How To Install And Configure Openbox Using Ubuntu

Introduction

Since 2011 the Ubuntu Linux distribution has used Unity as the default desktop environment and in most cases, this is a perfectly usable user interface with an intuitive launcher and dash which provides really good integration with common applications.

Sometimes though if you have an older machine you will want something a little bit lighter and you might go for something like Xubuntu Linux which uses the XFCE desktop or even Lubuntu which uses the LXDE desktop.

Some other distributions such as one I reviewed recently called 4M Linux use much lighter window managers such as JWM or IceWM. There aren't any official flavors of Ubuntu that come with these as the default option.

You can make something equally as lightweight by using the Openbox window manager. This is a fairly bare-bones window manager which you can build upon and customize as you so desire.

Openbox is the ultimate canvas for making the desktop just what you want it to be.

This guide shows you the basics of setting up Openbox within Ubuntu, how to alter the menus, how to add a dock and how to set the wallpaper.

01
of 08

Installing Openbox

How To Install Openbox Using Ubuntu
How To Install Openbox Using Ubuntu.

To install Openbox open a terminal window (Press CTRL, ALT and T) at the same time or search for "TERM" within the dash and click the icon.

Type the following command:

sudo apt-get install openbox obconf

Click on the icon in the top right corner and then choose log out.

02
of 08

How To Switch To Openbox

Switch To Openbox
Switch To Openbox.

Click on the little icon to the right of your username and you will now see two options:

  • Openbox
  • Ubuntu Default

Click on "Openbox".

Log in to your user account as normal.

03
of 08

The Default Openbox Screen

Blank Openbox
Blank Openbox.

The default Openbox screen is a fairly bland looking screen.

Right clicking on the desktop brings up a menu. At the moment that is all, there is to it. You can't really do much.

To start the customization process bring up the menu and choose terminal.

04
of 08

Change The Openbox Wallpaper

Openbox Change Wallpaper
Openbox Change Wallpaper.

The first thing to do is create a folder called wallpaper as follows:

mkdir ~/wallpaper 

You now need to copy some pictures into the ~/wallpaper folder.

You can use the cp command to copy from the pictures folder for your user as follows:

cp ~/Pictures/<nameofpicture> ~/wallpaper

If you want to download a new wallpaper open a web browser and use Google Images to search for an appropriate picture.

Right-click on the image and choose to save as and save the image in the wallpaper folder.

The program that we will use to set the wallpaper background is called feh.

To install feh run the following command:

sudo apt-get install feh

When the application has finished installing type the following command of setting the initial background.

feh --bg-scale ~/wallpaper/<nameofpicture>

Replace the <nameofpicture> with the name of the image you wish to use as the background.

At the moment this will only temporarily set the background. To set the background every time you log in you will need to create an autostart file as follows:

cd .config
mkdir openbox
cd openbox
nano autostart

In the autostart file enter the following command:

sh ~/.fehbg &

The ampersand (&) is incredibly important as it runs the command in the background so do not miss it out.

05
of 08

Add A Dock To Openbox

Add A Dock To Openbox
Add A Dock To Openbox.

Whilst the desktop now looks a little bit nicer it would be good to have a way of launching applications.

To do this I will show you how to install Cairo which is a fairly classy looking dock.

The first thing you need to do is install a compositing manager. Open up a terminal window and enter the following code:

sudo apt-get install xcompmgr

Now install Cairo as follows:

sudo apt-get install cairo-dock

Open the autostart file again by running the following command:

nano ~/.config/openbox/autostart

Add the following lines to the bottom of the file:

xcompmgr &
cairo-dock &

You should be able to restart openbox to make this work by typing the following command:

openbox --reconfigure

If the above command doesn't work log out and log back in again.

A message may appear asking whether you wish to use openGL or not. Select yes to continue.

The Cairo dock should now load and you should be able to access all of your applications.

Right click on the dock and choose the configuration option to play with the settings. A guide on Cairo is coming shortly.

06
of 08

Adjusting The Right Click Menu

Adjust Right Click Menu
Adjust Right Click Menu.

With the dock providing a decent menu the need for the context menu.

For completeness though here is how to adjust the right click menu.

Open a terminal again and run the following commands:

cp /var/lib/openbox/debian-menu.xml ~/.config/openbox/debian-menu.xml

cp /etc/X11/openbox/menu.xml ~/.config/openbox

cp /etc/X11/openbox/rc.xml ~/.config/openbox

openbox --reconfigure

Now when you right click on the desktop you should see a new Debian menu with an applications folder which links to the applications installed on your system.

07
of 08

Adjust The Menu Manually

Adjust Openbox Menu
Adjust Openbox Menu.

 If you want to add your own menu entries you can use the graphical application called obmenu.

Open a terminal and type the following:

obmenu &

A graphical utility will load.

To add a new sub menu select where you want the sub menu to be in the list and click "New Menu".

You will be asked to enter a label. 

To add a link to a new application click on the "New Item".

Enter a label (i.e. a name) and then enter the path to the command to execute. You can also press the button with three dots on it and navigate to the /usr/bin folder or indeed any other folder to find the file or program to run.

To remove items select the item to remove and click the small black arrow to the right of the toolbar and choose "Remove".

Finally, you can enter a separator by choose where you want the separator to appear and clicking "New Separator". 

08
of 08

Configuring Openbox Desktop Settings

Adjust Openbox Settings
Adjust Openbox Settings.

To adjust general desktop settings either right click on the menu and choose obconf or enter the following in a terminal:

obconf &

The editor is split into a number of tabs as follows:

  • Theme
  • Appearance
  • Windows
  • Move & Resize
  • Mouse
  • Desktop
  • Margins
  • Dock

The "theme" window lets you adjust the look and feel of the windows within Openbox.

There are a number of default themes but you can download and install some of your own.

The "appearance" window lets you adjust settings such as font styles, sizes, whether windows can be maximized, minimized, behavior codified, closed, rolled up and present on all desktops.

The "windows"  tab lets you see the behavior of windows. For example you can automatically focus on a window when the mouse hovers over it and you can set where to open new windows.

The "move & resize" window lets you decide how close windows can get to other windows before there is some resistence and you can set whether to move applications to new desktops when they are moved off the edge of a screen.

The "mouse" window lets you decide how windows get focus when the mouse hovers over them and also lets you decide how a double click affects a window.

The "desktop" window lets you decide how many virtual desktops there are and how long a notification is shown stating that you are about to switch desktops.

Th "margins" window lets you specify a margin around the screen whereby a window cannot pass over them. 

Summary

This document introduces you to the basic concepts of switching to Openbox. Another guide will be created to discuss the main settings files for Openbox and more customisation options.