Installing and Configuring Openbox

orionthehunter
  13 years ago
  23

openbox desktop with tint2 panelInstalling and Configuring Openbox

This tutorial is an example of how to install and set up one particular configuration of Openbox incorporating the tint2 panel and the nitrogen desktop wallpaper manager.  There are countless ways you could set up Openbox so my intent is to provide a relatively simple configuration that is easy to use and can be abstracted from.

Wallpaper to the left is available from: http://linuxmint-art.org/content/show.php/LMDE?content=138142

 


mint menu on gnome with cursor over synaptic package manager

Step 1: Open Synaptic Package Manager

Synaptic is the default package manager for debian and is included in Mint.  You can access synaptic via the Mint Menu under "Package Manager" or by running the command "sudo synaptic" the entering the administrative password.

 

 


Synaptic package manager with openbox search resultsStep 2: Find and select Openbox and other packages

In the Quick Filter textbox type "openbox".  This will bring up various packages related to the window manager.  From the results click the checkbox and select "Mark for Installation" to the left side of "openbox", "obconf", "obmenu", and "tint2".  These are respectively the metafile containing the main packages, the GUI configuration tool, the GUI menu configuration tool and a panel.  Now, in the Quick Filter textbox type "nitrogen".  Nitrogen is the wallpaper manager used by the CrunchBang linux distribution among others.


Synaptic package manager with cursor indicating apply buttonStep 3: Install packages by pressing Apply

Along the toolbar there is an apply changes button, the icon will depend on your icon set.  Pressing this will install all packages you have checked with "Mark for Installation".  

♦For those not familiar with Synaptic:  The button is called Apply instead of install because it can also be used to uninstall, reinstall, and update packages.  All changes are selected from the checkbox and none are performed until apply is pressed, allowing you to perform many actions all at once.


gdm session chooser with openbox selectedStep 4: Logging into Openbox

In order to log into Openbox you must access it from the login screen.  When you log out to the login screen you should find the button for "change session" or just "session" and click on it.  This will present you with a list of all the window managers and desktop environments you have installed.  Select Openbox, (not Gnome/Openbox or KDE/Openbox).  And then log in with your normal user name and password.

You will be presented with a blank screen and a mouse cursor.  DO NOT FEAR!


Openbox desktop with menu shownStep 5: Operating in Openbox

You can access the default Openbox Menu by right clicking anywhere on the desktop.  From here you should be able to open any application you have installed on your computer.  In order to log out you can select the "Exit" option at the bottom of the menu.

In order to see all programs you have open on all desktops you can middle click anywhere on the desktop, providing you with a simple task manager.  You can change desktop workspaces by pressing CTRL+ALT+LEFT and CTRL+ALT+RIGHT.  

Many people use Openbox just like this as it provides a bare bones environment for running programs and is friendly to keyboard shortcuts.  I'm going to explain how to make this environment a little bit more comfortable for those of us who prefer a slightly more traditional environment.

Your menu will probably look slightly different than the one I have pictured because I have customized mine to my own preferences.  I will describe this customization below in Step 7.


Step 6: Configuring the startup script to always start tint2 and nitrogen

screenshot of nitrogen wallpaper managerFirst, you will need to run Nitrogen once manually and select your background for it to know and remember which background on startup.

The autostart script is located at ~/.config/openbox/autostart.sh. If that file does not exist, then the system-wide default script, located at /etc/xdg/openbox/autostart.sh, is run instead (from: http://openbox.org/wiki/Help:Autostart).

 

 

Note that

~/.config/openbox/autostart.sh

is equivalent to

/home/USERLOGIN/.config/openbox/autostart.sh

where USERLOGIN is replaced by your user login name.

Open the autostart.sh with your favorite plain text editor.  I used gedit.  The following is my autostart.sh contents.  Feel free to copy and paste.  As you can see I also have dropbox and something called nm-applet starting.  Dropbox is a cloud based file server and nm-applet shows network connectivity.

# Run the system-wide support stuff
. $GLOBALAUTOSTART

# Programs to launch at startup
xcompmgr -c -t-5 -l-5 -r4.2 -o.55 &
nitrogen --restore &

# Programs that will run after Openbox has started
(sleep 2 && tint2) &
/usr/bin/nm-applet &
dropbox &


Step 7: Customizing the Openbox Menu

The Openbox menu can be configured to run basically any command and display just about any text you want, though some amount of scripting may be required depending on what you want.  I will guide you through creating a favorite applications list and a sample scripted action, taking a delayed screen shot.

We already installed the GUI Menu configuration tool called Obmenu.  You can start that by going through the right click menu and selecting the program or by launching it in a terminal.  However, you may find that it does will not save changes.  If this is true it is probably because there is not yet a custom menu file created.

The menu configuration file is located at ~/.config/openbox/menu.xml. If that file does not exist, then the system-wide default located at /etc/xdg/openbox/menu.xml, is used instead (from: http://openbox.org/wiki/Help:Menus).

The above link also contains advice for manually configuring the file.  But once you've put a menu in ~/.config/openbox/menu.xml the GUI program, Obmenu, will save normally.

When you open Obmenu you will see the Openbox 3 Menu collapsed under a triangular node icon.  In order to see the contents of the menu, left click on the triangle.

 

 

 

 

 

 

 

With the Openbox 3 menu node expanded you can now see all of the items in contains.  In order to add an item you must first select where you want it to appear in the menu.  A new item or sub-menu will appear directly above the selected item.  In the image shown on the left the new item would be added above Terminal emulator.

 

 

 

 

 

Once selected move the cursor to the toolbar and left click on the "New item" button if you want a new menu item.  Or "New menu" if you want to create a new sub-menu.  "New separator" creates a line to visually separate different areas of your menu.

 

 

 

 

 

 

After you've created a new item click on the textbox beside "Label" where "New item" is currently written.  Change the text to whatever you want to show on your menu, for example "Firefox" or "Web browser" or "Internet" or even "Series of tubes".  Pretty much anything is fine.  Below that is "Action" beside which is list which currently shows "Execute" as selected.  Execute allows you to run a program or a script from file.  Underneath you see the word "Execute" again beside which is a textbox that has defaulted to "command".  Replace command with the program or directory path and program you want to run, for example "chromium-browser" or "synaptic".  For this field you must type it correctly or the command will not execute.  To run things that require administrator privileges prefix the command with "gksudo " for example, "gksudo synaptic".  This will prompt for a password and allow you to use administrator privileged tools.

Finally, save changes by clicking the top left button in the menu bar or go to File -> Save or press Ctrl + S.


Step 8: Customizing the tint2 panel

After you have installed tint2 (assuming you performed steps 1 to 3) run tint2 either by selecting it from the menu or running it from the terminal with:

tint2 &

This should create a default configuration file that we can edit at ~/.config/tint2/tint2rc

So next we edit this with our favorite text editor (there is not as far as I know a GUI editor for tint2).  I will use gedit in my example:

gedit ~/.config/tint2/tint2rc

I won't go into detail describing the parameters with which you can customize tint2 as they are available from http://code.google.com/p/tint2/wiki/Configure.

Do note that some system tray applets you might be used to don't load by default like pulse audio and network manager.

Comments
madwoollything 12 years ago

Great tutorial however there appears to be a problem in LMDE in getting the newly installed Openbox session to launch.

http://forums.linuxmint.com/viewtopic.php?f=190&t=95954


asymmetros 12 years ago

I heard about a little "program", obkey, which acts as a gui for addressing keybindings instead of editing the rc.xml file.
I tried it and it did the trick!
You can check it there: http://code.google.com/p/obkey/. It does not need installation, just extract it and execute the obkey file.


spider2097 12 years ago

Good tutorial! :) Do you know if there is a way to make the right-click function open Mint Menu instead of the Openbox menu? As @omns points out, this starts to look a bit like Crunchbang with Mint wallpaper :?


mikk0 12 years ago

Thanks for this howto.
I really like the simplicity and directness of openbox, now that I have it running - much more than I ever expected. I like the mint Julia default desktop a lot as well, wouldn't like to say which of the two I prefer just now ... :)


asymmetros 13 years ago

{quote}
There are countless ways you could set up Openbox
{quote}

That's one great thing about Openbox. You have covered briefly all the basic staff.


orionthehunter 13 years ago

Basically complete. If there's any confusion or more detail is requested on specific parts then I'll be happy to try to clarify or elaborate. I hope some people can make use of this.


orionthehunter 13 years ago

@remoulder I'm not necessarily aiming this at LMDE users, I just happen to be one. The same packages are available in the main versions.


remoulder 13 years ago

Nice, but if you are aiming this at LMDE users, you might want to include that in the title?


orionthehunter 13 years ago

@omns: Yes basically that is what I'm showing how to do. But Crunchbang provides liveCDs and installers, this tutorial shows someone how to set up Openbox as an alternative desktop session without installing an entirely new distribution. Some may find this favorable.


omns 13 years ago

Looks a lot like setting up a basic CrunchBang like system...