2008-03-08

Openbox - introduction/customization

Overview: At the end your system may have this look:

[screenshots - click]

screenshot #1 screenshot #2

Intro:

Openbox is a windows manager (just like Metacity, sort of..), extremely light and customizable, known for its minimalistic appearance, as indicated for machines with poor performance.

The Openbox allows perform the last/all* applications that are designed/made to Gnome/Kde without any need to run these (Gnome/Kde). You can also run the Openbox within the Gnome/Kde thus combining their features. It allows us to make the desktop cleaner and faster.


Installation:

Check the homepage, or install the version available in the repositories:
# aptitude install openbox
# aptitude install obconf openbox-themes #RECOMMENDED_EXTRAS

To run Openbox:
  • Logout;
  • Choose the session type: (1) Gnome/Openbox; (2) openbox-kde.desktop or (3) Openbox Session;
  • Login.

Option (3) runs only the Openbox, but future Gnome/Kde's applications could be executed (eg: gnome-panel)

Note: I recommend that you only [re]login (at openbox session) when thou finish the tutorial completely!


Customization:

If you choose option (3) above, you will find out that your desktop is empty, and no kind of bar is displayed. Don't stress out :D

  1. Double the configuration files:

    $ mkdir -p ~/.config/openbox/
    $ cp /etc/xdg/openbox/rc.xml ~/.config/openbox/rc.xml
    $ cp /etc/xdg/openbox/menu.xml ~/.config/openbox/menu.xml


    The rc.xml file is responsible for the configuration of shortcuts, themes, virtual desktop, etc. .. While the menu.xml file is only responsible for setting the menu that appears when you click with the right mouse button on the desktop - edit this file in text mode can be boring and complicated, ahead there is a solution easier.

  2. Alt+F2:

    The shortcut Alt + F2 aka gnome-panel-control - run-dialog does not work for Openbox. I think this command essential in any Linux distribution, so let's find an alternative solution: gmrun - installation:

    # aptitude install gmrun

    Define Alt-F2 as gmrun's shortcut:
    $ gedit ~/.config/openbox/rc.xml
    Add the following code before;</keyboard>

    <keybind key="A-F2">
    <action name="execute">
    <execute>gmrun</execute>

    </action>

    </keybind>

    Note: If you noticed, the last shortcut existing in rc.xml is 'W-e', which launches Konqueror. I replaced this with Nautilus. I like it best.

    <keybind key="W-e">
    <action name="Execute">
    <startupnotify>
    <enabled>true</enabled>
    <name>Nautilus</name>
    </startupnotify>
    <command>nautilus</command>
    </action>
    </keybind>


    Note2:
    In my case, i had re-login the session for the shortcuts work correctly.

  3. Add a panel:

    I think that all of us like to have some kind of panel. To see minimized windows, icon tray and some shortcuts.
    There are several alternatives such as: pypanel , fbpanel, gnome-panel, xfce4-panel, etc.
    I'll choose pypanel:

    $ aptitude install pypanel

    • Pypanel Customization:
      The configuration file is ~/.pypanelrc. Before change/edit him I recommend to backup it:
      $ cp ~/.pypanelrc ~/.pypanelrcbackup

      Now, take this code (link) a save it at:
      $ gedit ~/.pypanelrc

  4. Add pypanel to startup(or some other application):

    $ gedit ~/.config/openbox/autostart.sh

    Paste this text:
    # Run the system-wide support stuff
    . $GLOBALAUTOSTART
    # Programs to launch at startup
    pypanel &
    #/opt/wicd/tray.py & #WICD
    #conky & #CONKY
    # all commands must end with: " &"


    Follow the example to add some other applications.

  5. Edit Openbox's theme:

    As I earlier explain, it's possible to edit Openbox's theme at the file menu.xml. But there is a solution more user friendly: obmenu. To install obmenu:

    $ wget http://switch.dl.sourceforge.net/sourceforge/obmenu/obmenu-1.0.tar.gz
    $ tar xvzf obmenu-1.0.tar.gz
    $ cd obmenu-1.0/
    # python setup.py install

    Open obmenu:
    $ obmenu

    The you can add/remove/edit any kind of shortcuts, etc.
    Note: To add a new menu, in the end you need to add a shortcut at Openbox 3 menu. Watch with some attention the available examples..

Conclusion:

This tutorial gives you the main ideas how to customize your system. Of course the are more applications you might use at Openbox, but these were my choice.


Other references:

»Openbox homepage
»Pypanel homepage
»Obmenu homepage
»Archlinux wiki - openbox
»Debian wiki - openbox some interesting key shortcuts.
»Box-Look.org - themes

»Used wallpaper!

My files:
There might be some differences with the screenshot displayed.
»http://dotfiles.org/~uterrorista/.pypanelrc
»http://dotfiles.org/~uterrorista/.autostart.sh
»http://dotfiles.org/~uterrorista/menu.xml
»http://dotfiles.org/~uterrorista/rc.xml

11 comments:

Unknown said...

Have you a link for your wallpaper without the green splash ?

Tanh you.

JoaoG aka uterrorista said...

No, I haven't.
The wallpaper is not mine and the only image I have is linked in the article.

Cheers

Unknown said...

Well, no problem.

Thank you.

Gz said...

Nice design you chose!
How do you install the system information that's on the top right corner? Can you give a detailed instruction?
Thanks in advance!

JoaoG aka uterrorista said...

Hello Giza.
That's CONKY.

INSTRUCTIONS e.g.:
http://linuxdeb.com/en/linux/how-to/conky/

Search the Ubuntu forum e.g. There are plenty of examples.

Gz said...

uterrorista:
Thanks a lot for a quick reply! I have installed conky, and now trying many well-designed scripts :)

James said...

Hey :)

Uhm I'm in a bit of a pickle here.
I've done everything you said but nothing works for me. Like when i edited the menu.xml file with obmenu nothing happens and the Alt-F2 shortcut doesn't work and neither does the startup script. I've restarted my computer and they still don't work.
Any suggestions?

JoaoG aka uterrorista said...

Hi James.

I just followed this tutorial to the end of step 2, and worked for me.

After the installation step, Alt+F2 shouldn't work. That's why, we create our 'rc.xml', and tune it to make possible that 'gmrun' application may be launched pressing the Alt+F2.

My rc.xml is here: http://pastebin.com/m3ebfc50a

Don't quite know what is you problem, but check the rc.xml file first.

BTW, what is your distro/version?

James said...

-JoaoG

I've tried that but it still doesn't work.
I've saved the file in ~/.config/openbox
but I think it should be saved in the Home folder.

Debian Etch

JoaoG aka uterrorista said...

I'm using Ubuntu, and this worked just fine for me.

I recommend that you check
http://wiki.debian.org/Openbox
or visit
http://forums.debian.net/
for more help. I don't know if Debian can be much different of Ubuntu.

~/.config/openbox
is the same as:
/home/YOUR-USER/.config/openbox

Anonymous said...

that was useful.

thanks for taking the time to share the wisdom.

cheers