Contents

Openbox | The Ins and outs of the most mature and feature rich window manager

Installation

To install a basic openbox environment we need the following

  • openbox
  • nitrogen for desktop background (may use feh or xset)
  • tint2 ( best panel for openbox)
  • obconf and lxappearance ( for customization)

optional (will be discussed further in article)

  • obmenu-qt ( a gui for the menu construction)
  • obamenu (a menu generator)
  • obapps3 (frontend for window customizations)

We will use the terminal to install openbox and essential packages:

1
sudo apt install openbox obconf nitrogen tint2 lxappearance
1
sudo dnf install openbox obconf nitrogen tint2 lxappearance
1
sudo pacman -S openbox obconf nitrogen tint2 lxappearance

After installation we look for /home/yourusername/.config/openbox . If not found we create it

1
mkdir ~/.config/openbox

We add to it the default configuration files found at the etc directory

1
cp -a /etc/xdg/openbox/ ~/.config/

Autostart

In the autostart file add the following:

1
2
3
4
tint2 &
nitrogen --restore &
# if you installed conky , you can run it on autostart
# conky &

A sample simple menu.xml

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?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 icon="/path/terminal.png" label="Terminal emulator"><action name="Execute"><execute>lxtermina</execute>
          </action> </item>
    <item icon="/path/gedit.png" label="Gedit Text Editor"><action name="Execute"><execute>gedit</execute>
          </action> </item>
    <item icon="/path/thunar.png" label="Thunar File manager"><action name="Execute"> <execute>thunar</execute>
          </action> </item>

    <item icon="/pathfirefox-esr.png" label="Firefox"><action name="Execute"> <execute>firefox</execute>
           </action> </item>
    <separator />
  <menu id="mymenu" label="Battery" execute="~/scripts/battery.sh" /> 
  <menu execute="python /usr/bin/obamenu" id="applications-menu" icon="/path/science.png" label="Apps" />
    <separator />
    <separator />
    <item icon="path/obconf.png" label="ObConf"><action name="Execute"><execute>obconf</execute></action></item>
    <item label="Reconfigure"> <action name="Reconfigure" />    </item>
    <item icon="/path/restart.png" label="Restart"><action name="Restart" /> </item>
    <separator />
    <item label="Exit"><action name="Execute"><execute>lxsession-logout</execute></action></item>
  </menu>
</openbox_menu>

instead of the tedious manual establishment of a personal menu, I will use a gui app which will facilitate the construction of a menu with icon support.

obmenu-qt

obmenu-qt can be installed from the following website

https://github.com/shaggyz/obmenu-qt

install dependencies first:

1
sudo apt install python3-setuptools python3-pyqt5 python3-lxml
1
sudo dnf install python3-setuptools python3-pyqt5-sip python3-lxml
1
yay -S obmenu3

After downloading the zip file from github run the following

1
sudo python setup.py install

after that run obmenu-qt in terminal to launch

pipe menus

example of pipe menu

1
2
3
4
5
6
7
8
#!/bin/bash
Battery=$(acpi -b | grep "Battery" | sed -nr '/Battery/s/.*(\<[[:digit:]]+%).*/\1/p')
Thermal=$(acpi -t | grep "Thermal" | sed -nr "s/.*(\<[[:digit:]]+\.[[:digit:]]) degrees.*/\1°C/p" )
echo "<openbox_pipe_menu>"
echo "<item label=\"Battery: $Battery\"/>"
echo "<item label=\"Temperature: $Thermal\"/>"

echo "</openbox_pipe_menu>"

obamenu

it is a lightweight menu generator for all applications using a simple python code. It is most probably installed on many systems but in case you did not have it

themes

Theme locations are in /usr/share/themes or ~/.themes themes can be tweaked using obconf and lxappearance

rc.xml

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171

<?xml version="1.0" encoding="UTF-8"?>
<openbox_config xmlns="http://openbox.org/3.4/rc" xmlns:xi="http://www.w3.org/2001/XInclude">
 
  <resistance>
    <strength>10</strength>
    <screen_edge_strength>20</screen_edge_strength>
  </resistance>
  <focus>
    </focus>
  <placement>
    <policy>Smart</policy>
   
  </placement>
  <theme>
    <name>sparky5</name>
    <titleLayout>NLIMC</titleLayout>
    <!--
      available characters are NDSLIMC, each can occur at most once.
      N: window icon
      L: window label (AKA title).
      I: iconify
      M: maximize
      C: close
      S: shade (roll up/down)
      D: omnipresent (on all desktops).
  -->
     </theme>
  <desktops>
   
     <number>4</number>    <firstdesk>1</firstdesk>
    <names>      <name>1</name>      <name>2</name>      <name>3</name>      <name>4</name>    </names>
    <popupTime>875</popupTime>
    <!-- The number of milliseconds to show the popup for when switching
       desktops.  Set this to 0 to disable the popup. -->
  </desktops>
  
  <margins>
    <top>0</top>
    <bottom>0</bottom>
    <left>6</left>
    <right>0</right>
  </margins>
  <dock> 
    <!-- 'Left', 'Middle', 'Right' -->
  </dock>
  <keyboard>  

  </keyboard>
  
  <mouse>
    <dragThreshold>1</dragThreshold>
    <!-- number of pixels the mouse must move before a drag begins -->
    <doubleClickTime>200</doubleClickTime>
    <!-- in milliseconds (1000 = 1 second) -->
    <screenEdgeWarpTime>400</screenEdgeWarpTime>
    <!-- Time before changing desktops when the pointer touches the edge of the
       screen while moving a window, in milliseconds (1000 = 1 second).
       Set this to 0 to disable warping -->
    <screenEdgeWarpMouse>false</screenEdgeWarpMouse>
    <!-- Set this to TRUE to move the mouse pointer across the desktop when
       switching due to hitting the edge of the screen -->
    <context name="Frame">     
    </context>
    
    <context name="Titlebar">
    </context>

    <context name="Top">
      <mousebind button="Left" action="Drag">""        <action name="Resize">""          <edge>top</edge>""        </action>""      </mousebind>
    </context>

    <context name="Left">
      <mousebind button="Left" action="Drag">""        <action name="Resize">""          <edge>left</edge>""        </action>""      </mousebind>
    </context>

    <context name="Right">
      <mousebind button="Left" action="Drag">""        <action name="Resize">""          <edge>right</edge>""        </action>""      </mousebind>
    </context>

    <context name="Bottom">
      <mousebind button="Left" action="Drag">""        <action name="Resize">""          <edge>bottom</edge>""        </action>""      </mousebind>
      <mousebind button="Right" action="Press">""        <action name="Focus"/>""        <action name="Raise"/>""        <action name="ShowMenu">""          <menu>client-menu</menu>""        </action>""      </mousebind>
    </context>

    <context name="TRCorner BRCorner TLCorner BLCorner">
      
    </context>

    <context name="Client">
      
    </context>
    <context name="Icon">
      
    </context>

    <context name="AllDesktops">
      
    </context>

    <context name="Shade">
    
    </context>
    <context name="Iconify">
      
    </context>
    <context name="Maximize"> 
          </context>

    <context name="Close">
      
    </context>

    <context name="Desktop">
     
    </context>
    <context name="Root">

      <!-- Menus -->
      <mousebind button="Right" action="Press">""        <action name="ShowMenu">""          <menu>root-menu</menu>""        </action>""      </mousebind>
    </context>
    <context name="MoveResize">
      <mousebind button="Up" action="Click">""        <action name="GoToDesktop">""          <to>previous</to>""        </action>""      </mousebind>
      <mousebind button="Down" action="Click">""        <action name="GoToDesktop">""          <to>next</to>""        </action>""      </mousebind>
      <mousebind button="A-Up" action="Click">""        <action name="GoToDesktop">""          <to>previous</to>""        </action>""      </mousebind>
      <mousebind button="A-Down" action="Click">""        <action name="GoToDesktop">""          <to>next</to>""        </action>""      </mousebind>
    </context>
  </mouse>

  <menu>
    <!-- You can specify more than one menu file in here and they are all loaded,
       just don't make menu ids clash or, well, it'll be kind of pointless -->
    <!-- default menu file (or custom one in $HOME/.config/openbox/) -->
    <!-- system menu files on Debian systems -->
    <file>/var/lib/openbox/debian-menu.xml</file>
    <file>menu.xml</file>
    <hideDelay>200</hideDelay>
    <!-- if a press-release lasts longer than this setting (in milliseconds), the
       menu is hidden again -->
    <middle>no</middle>
    <!-- center submenus vertically about the parent entry -->
    <submenuShowDelay>100</submenuShowDelay>
    <!-- time to delay before showing a submenu after hovering over the parent
       entry.
       if this is a negative value, then the delay is infinite and the
       submenu will not be shown until it is clicked on -->
    <submenuHideDelay>400</submenuHideDelay>
    <!-- time to delay before hiding a submenu when selecting another
       entry in parent menu
       if this is a negative value, then the delay is infinite and the
       submenu will not be hidden until a different submenu is opened -->
    <applicationIcons>yes</applicationIcons>
    <!-- controls if icons appear in the client-list-(combined-)menu -->
    <manageDesktops>yes</manageDesktops>
    <!-- show the manage desktops section in the client-list-(combined-)menu -->
  </menu>
  
-->
  <applications><application class="*"> <decor>no</decor></application>
   <application class="Double Commander">      <desktop>1</desktop>      <focus>yes</focus>    </application>
    <application class="firefox">      <desktop>2</desktop>      <focus>yes</focus>    </application>
    <application class="VirtualBoxVM">      <desktop>3</desktop>      <focus>yes</focus>    </application>
    <application class="Xfce4-terminal">      <desktop>4</desktop>      <focus>yes</focus>    </application>
    <application class="Lxterminal"> <position>  <x>-0</x>      <y>0</y>         </position>      
    <size>      <width>50%</width>      <height>100%</height>    </size>   <focus>yes</focus>    </application>
    
    <application class="Yad">      <decor>yes</decor>    </application>
  </applications>  <application name="main">desktop>1</desktop> size><width>50%</width>  <height>100%</height>
    </size>    <position force="yes">      <x>-0</x>      <y>0</y>    </position>  </application>

</openbox_config>

keybindings

Some windows and special keybindings

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<keybind key="A-F4">      <action name="Close"/>    </keybind>
<keybind key="C-A-Delete"><action name="Execute"><command>lxsession-logout</command></action></keybind>
<keybind key="W-d"><action name="ToggleShowDesktop"/></keybind>
<keybind key="W-r"><action name="Execute"><command>rofi -show run</command></action></keybind>
<keybind key="W-e"><action name="Execute"><command>thunar        </command></action>
<keybind key="W-S-Escape"><action name="Execute"><command>lxtask </command></action>
<keybind key="A-Tab"><action name="NextWindow"><raise>yes</raise></action></keybind>
<keybind key="A-S-Tab"><action name="PreviousWindow"><raise>yes</raise></action></keybind>
<keybind key="XF86MonBrightnessUp"><action name="Execute"><command>brightnessup.sh</command></action></keybind>
<keybind key="XF86MonBrightnessDown"><action name="Execute"><command>brightnessdown.sh</command></action>
</keybind>
<keybind key="XF86AudioRaiseVolume"><action name="Execute">
      <command>pactl set-sink-volume $(pacmd list-sinks | awk '/* index: [0-9]+/{ print $3 }') +5%</command>
      </action></keybind>
<keybind key="XF86AudioLowerVolume"><action name="Execute">
      <command>pactl set-sink-volume $(pacmd list-sinks | awk '/* index: [0-9]+/{ print $3 }') -5%</command>
      </action></keybind>
<keybind key="XF86AudioMute"><action name="Execute">
      <command>pactl set-sink-mute @DEFAULT_SINK@ toggle</command>
      </action></keybind>
<keybind key="XF86Calculator"><action name="Execute"><command>galculator</command>
  <!--windows pseudo tiling -->
<keybind key="W-Left"> <action name="Unmaximize"/>
    <action name="MoveResizeTo"> <x>0</x> <y>0</y> <width>50%</width> <height>100%</height></action> </keybind>
<keybind key="W-Right"><action name="Unmaximize"/>
    <action name="MoveResizeTo"> <x>-0</x><y>0</y> <width>50%</width> <height>100%</height></action> </keybind>

Other nice keybindings

1
2
3
4
5
6
<!-- to show menu -->
 <keybind key="W-m"><action name="ShowMenu"><menu>mymenu</menu></action></keybind>
<!--to toggle tint2 on off -->
<keybind key="W-b"><action name="Execute">
      <command>sh -c "sed -i -r 's/(autohide\ \=\ )0/\11/;t;s/(autohide\ \=\ )1/\10/' ~/.config/tint2/tint2rc;killall -SIGUSR1 tint2"</command>
      </action></keybind> 

mouse bindings

notable mouse binding

1
2
3
4
5
6
<context name="Frame">
      <mousebind button="C-Middle" action="Press">""        <action name="ShowMenu">""          <menu>root-menu</menu>""        </action>""      </mousebind>
      <mousebind button="Button9" action="Press">""        <action name="Execute">""          <command>xdotool key ctrl+c </command>""        </action>""      </mousebind>
      <mousebind button="Button8" action="Press">""        <action name="Execute">""          <command>xdotool key ctrl+v </command>""        </action>""      </mousebind>
      <mousebind button="A-Left" action="Click">""        <action name="Unshade"/>""      </mousebind>
      <mousebind button="C-Left" action="Drag">""        <action name="Move"/>""      </mousebind>

mouse button X11 mapping is as follows:

  • 1 = left button
  • 2 = middle button (pressing the scroll wheel)
  • 3 = right button
  • 4 = turn scroll wheel up
  • 5 = turn scroll wheel down
  • 6 = push scroll wheel left
  • 7 = push scroll wheel right
  • 8 = 4th button (aka browser backward button)
  • 9 = 5th button (aka browser forward button)

Applications/Window setting

You can manually change the behaviour of application windows and placement inside the rc.xml example

1
2
3
4
5
6
7
<applications>
    <application class="*">           <decor>no</decor>                               </application>
    <application class="firefox">     <decor>yes</decor>                              </application>

    <application class="Doublecmd">   <desktop>1</desktop>      <focus>yes</focus>    </application>
    <application class="firefox">     <desktop>2</desktop>      <focus>yes</focus>    </application>
</applications>    

or alternatively you can use obapps3 since it is much easier to use since you cant remember all the options needed in the settings without seing documentation.

obapps3

For installation of dependencies

1
sudo apt install python3-wxgtk4.0 wxpython-tools python3-xlib
1
sudo dnf install python3 python3-xlib python3-wxpython4
1
sudo pacman -S python-wxpython python-xlib python3

Next you go to the apps gihub page and download the whole repo.

After unzipping run

1
sudo python setup.py install
1
sudo python setup.py install
1
yay -S obapps3

and run obapps in terminal to access it