Introduction to openbox

Share your wisdom. Not for support questions!

Moderator: How-to Curator

Introduction to openbox

Postby traveler » November 22nd, 2011, 8:23 pm

Discussion is here.

This How-To's intended audience is newcomers, but anyone who has not yet tried openbox might find some useful information also. My intent is to cover how to install and configure openbox on top of a clean Xfce installation and have it up and running in a usable fashion as quickly as possible. This is my preferred method and it's simple. The result will be a resource-sipping, yet aesthetically-pleasing system.

I used the Debian 6 net install cd for this guide.
After booting to the installation menu, do as follows:
-Advanced options/Alternate Desktop Environments/Xfce
-Choose Install Method and Proceed with installation
When you are offered the Software Selection Menu make sure you select at least the “Graphical Desktop Environment” and “Standard System Utilities” options. If it's a laptop, go ahead and select that option as well.
Once the installation is complete and you have logged in to your Xfce session, we can get the ball rolling.

Log into your terminal and take root. Just to be sure you are up-to-date go ahead and:
Code: Select all
aptitude update

Code: Select all
aptitude upgrade


Time for the basic packages... Open your terminal and take root, of course:
Code: Select all
aptitude install openbox openbox-themes lxappearance nitrogen xcompmgr obconf obmenu gmrun tint2

(If you want a panel applet for volume control and you run Wheezy or Sid, volumeicon-alsa is in the repos and works quite well. On Squeeze, you will have to manually install it. See http://softwarebakery.com/maato/volumeicon.html for details.)

Behold how boring this is!
Image

As your user, copy the openbox config files to your home directory as follows:
Code: Select all
cp -r /etc/xdg/openbox/ /home/yourusername/.config/

It's also a good idea to back up all the default config files before proceeding. If not, you know where the defaults are stored in /etc/xdg/openbox/
All files should be edited as your user.

Time to customize the menu a bit.
Open /home/yourusername/.config/openbox/menu.xml with your editor of choice. Alternatively, you can simply use obmenu to make any desired changes.

Here is my recommended menu.xml to get things started:
Code: Select all
<?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/                 file:///usr/share/openbox/menu.xsd">
   <menu id="root-menu" label="Openbox 3">
      <item label="Run Command">
         <action name="Execute">
            <execute>
               gmrun
            </execute>
         </action>
      </item>
      <item label="Terminal Emulator">
         <action name="Execute">
            <execute>
               x-terminal-emulator
            </execute>
         </action>
      </item>
      <item label="File Manager">
         <action name="Execute">
            <execute>
               thunar
            </execute>
         </action>
      </item>
      <item label="Web Browser">
         <action name="Execute">
            <execute>
               firefox
            </execute>
         </action>
      </item>
      <separator/>
      <menu id="Debian"/>
      <!-- This requires the presence of the 'menu' package to work -->
      <menu id="client-list-menu"/>
      <separator/>
      <item label="Nitrogen">
         <action name="Execute">
            <execute>
               nitrogen
            </execute>
         </action>
      </item>
      <item label="lxappearance">
         <action name="Execute">
            <execute>
               lxappearance
            </execute>
         </action>
      </item>
      <item label="obConf">
         <action name="Execute">
            <execute>
               obconf
            </execute>
         </action>
      </item>
      <item label="obMenu">
         <action name="Execute">
            <execute>
               obmenu
            </execute>
         </action>
      </item>
      <separator/>
      <item label="Reconfigure">
         <action name="Reconfigure"/>
      </item>
      <item label="Restart">
         <action name="Restart"/>
      </item>
      <separator/>
      <item label="Logout">
         <action name="Exit"/>
      </item>
   </menu>
</openbox_menu>

Note: Depending on your release, you may need to make one minor change to have a working Debian menu.
Original- Works with Squeeze, do not modify:
Code: Select all
<menu id="Debian"/>

For Wheezy or Sid, modify as follows:
Code: Select all
<menu id="/Debian"/>

The result:
Image


Launch Nitrogen and select your own wallpaper. If it's a totally fresh install and you have none at this point, some debian artwork is in /usr/share/images/desktop-base/ as seen in the screenshot below.

Next, open autostart.sh in your editor. I nuke it and replace as follows (more or less):
Code: Select all
xcompmgr &
tint2 &
xfce4-power-manager &
nitrogen --restore &
xscreensaver -no-splash &


If you want to check your progress at this point, log out and back in. You should be presented with something like this:
Image
You now have a panel and compositing, among other things.

Now open rc.xml
In this file you'll find theme settings, keybindings and window behavior for example. At a bare minimum, you should spend some time looking it over to learn the keybindings. If you want to take it a step further, gimp the ones you deem useful into a wallpaper until you know them by heart, or pull a crunchbang and throw a conky together with them in it. You can leave it alone if you like, but using the default and custom keybindings really make the experience a lot more efficient in my opinion. My rc.xml is pretty much default aside from assigning some keybindings for apps I use a lot- I guess I am lazy and/or don't need much more than this. Binding gmrun to W-space (for me) just about removes the need to even have a working Debian menu. Configure them to your liking. Just avoid creating any that conflict with defaults. If you look through the rc.xml, it should be apparent where these would logically be inserted, but I don't believe it really matters where you put them.
Note: “W” aka “Mod4” aka “Windows” key.
Some keybindings I use- just as an example:
Code: Select all
<!-- Custom keybindings for applications -->
    <keybind key="W-space">
      <action name="Execute">
        <command>gmrun</command>
      </action>
    </keybind>
    <keybind key="W-z">
      <action name="Execute">
        <command>thunar</command>
      </action>
    </keybind>
    <keybind key="W-g">
      <action name="Execute">
        <command>geany</command>
      </action>
    </keybind>
    <keybind key="W-q">
      <action name="Execute">
        <command>xflock4</command>
      </action>
    </keybind>
    <keybind key="W-t">
      <action name="Execute">
        <command>terminator</command>
      </action>
    </keybind>
    <keybind key="W-f">
      <action name="Execute">
        <command>firefox</command>
      </action>
    </keybind>


You're pretty much done at this point. Welcome to openbox!

Below are a few more things I like to do on my setup.
Code: Select all
aptitude install terminator scrot murrine-themes xfonts-terminus irssi geany


Replace the default tint2 panel with my own.
/home/username/.config/tint2/tint2rc
Code: Select all
#---------------------------------------------

# TINT2 CONFIG FILE

#---------------------------------------------



#---------------------------------------------

# BACKGROUND AND BORDER

#---------------------------------------------

rounded = 7

border_width = 2

background_color = #000000 60

border_color = #ffffff 18



rounded = 5

border_width = 0

background_color = #ffffff 40

border_color = #ffffff 50



rounded = 5

border_width = 0

background_color = #ffffff 18

border_color = #ffffff 70



#---------------------------------------------

# PANEL

#---------------------------------------------

panel_monitor = all

panel_position = bottom center

panel_size = 85% 30

panel_margin = 0 0

panel_padding = 7 0

font_shadow = 0

panel_background_id = 1

wm_menu = 1

panel_dock = 0

panel_layer = bottom



#---------------------------------------------

# TASKBAR

#---------------------------------------------

taskbar_mode = multi_desktop

#taskbar_mode = single_desktop

taskbar_padding = 2 3 2

taskbar_background_id = 0

#taskbar_active_background_id = 0



#---------------------------------------------

# TASKS

#---------------------------------------------

task_icon = 1

#task_text = 1

task_text = 0

#task_maximum_size = 140 35

task_maximum_size = 40 20

task_centered = 1

task_padding = 6 3

task_font = sans 7

task_font_color = #ffffff 70

task_background_id = 3

task_icon_asb = 100 0 0

# replace STATUS by 'urgent', 'active' or 'iconfied'

#task_STATUS_background_id = 2

#task_STATUS_font_color = #ffffff 85

#task_STATUS_icon_asb = 100 0 0

# example:

task_active_background_id = 2

task_active_font_color = #ffffff 85

task_active_icon_asb = 100 0 0

urgent_nb_of_blink = 8



#---------------------------------------------

# SYSTRAYBAR

#---------------------------------------------

systray = 1

systray_padding = 0 4 5

systray_background_id = 0

systray_sort = left2right

systray_icon_size = 0

systray_icon_asb = 100 0 0



#---------------------------------------------

# CLOCK

#---------------------------------------------

time1_format = %H:%M

time1_font = sans 8

time2_format = %A %d %B

time2_font = sans 6

clock_font_color = #ffffff 76

clock_padding = 1 0

clock_background_id = 0

#clock_lclick_command = xclock

#clock_rclick_command = orage

#clock_tooltip = %A %d %B

#time1_timezone = :US/Hawaii

#time2_timezone = :Europe/Berlin

#clock_tooltip_timezone = :/usr/share/zoneinfo/Europe/Paris



#---------------------------------------------

# BATTERY

#---------------------------------------------

#battery = 0

#battery_hide = 98

#battery_low_status = 10

#battery_low_cmd = notify-send "battery low"

#bat1_font = sans 8

#bat2_font = sans 6

#battery_font_color = #ffffff 76

#battery_padding = 1 0

#battery_background_id = 0



#---------------------------------------------

# TOOLTIP

#---------------------------------------------

tooltip = 1

tooltip_padding = 2 2

tooltip_show_timeout = 0.7

tooltip_hide_timeout = 0.3

tooltip_background_id = 1

tooltip_font_color = #FFFFFF 100

tooltip_font = terminus 9



#---------------------------------------------

# MOUSE ACTION ON TASK

#---------------------------------------------

mouse_middle = none

mouse_right = close

mouse_scroll_up = toggle

mouse_scroll_down = iconify



#---------------------------------------------

# AUTOHIDE OPTIONS

#---------------------------------------------

autohide = 0

autohide_show_timeout = 0.3

autohide_hide_timeout = 2

autohide_height = 4

strut_policy = minimum


Configure terminator.
/home/username/.config/terminator/config
Code: Select all
[global_config]
  handle_size = 1
  focus = mouse
[keybindings]
[profiles]
  [[default]]
    scrollbar_position = hidden
    show_titlebar = False
    background_darkness = 0.7
    scrollback_lines = 2000
    cursor_shape = underline
    cursor_color = "#e5db1d"
    foreground_color = "#e5db1d"
    background_type = transparent
[layouts]
  [[default]]
    [[[child1]]]
      type = Terminal
      parent = window0
    [[[window0]]]
      type = Window
      parent = ""
[plugins]


Add a red root prompt to keep myself out of trouble.
I just put it at the bottom of /root/.bashrc
Code: Select all
#red root prompt

TERM_USER_HOST_COLOR='0;31m'
TERM_PATH_COLOR='0;31m'
TERM_PROMPT_COLOR='m'


TERM_USER_HOST='\u@\h'
TERM_PATH='\w'
TERM_PROMPT='\$'


export PS1=\
'\[\e['${TERM_USER_HOST_COLOR}'\]'${TERM_USER_HOST}'\[\e[m\]'\
' \[\e['${TERM_PATH_COLOR}'\]'${TERM_PATH}'\[\e[m\]'\
' \[\e['${TERM_PROMPT_COLOR}'\]\$\[\e[m\] '


After some tinkering:
Image

Openbox links:
http://openbox.org/
http://box-look.org/
http://urukrama.wordpress.com/openbox-guide/

Other How-To's you may want to use:
Enable Autohinting System-wide
Allow users to shutdown computer from a window manager
Install ps_mem.py

That's all I have for now, but may be adding more information in the future. If you have anything you'd like to have added or spot an error please share in the discussion thread.
I just got kicked out of McDonalds...
User avatar
traveler
 
Posts: 1095
Joined: February 9th, 2011, 2:20 pm
Location: Detroit

Return to HowTo

Who is online

Users browsing this forum: No registered users and 3 guests

x