From Mageia wiki
Jump to: navigation, search
Drakconf multiflag.png
Other languages

Deutsch ; English


Installing Openbox

Installing Openbox works in the same way as installing other software and is done through the Software Manager ("Install & Remove Software"), which is accessed via the Mageia Control Center or the application menu on the panel.

OB.png

Find openbox, xcompmgr, tint2, feh, gmrun, docky, mate-polkit and simply install them. You can enter all of them in the Find: prompt with a space between them. This is basically what you need. Openbox is not a fully fledged Desktop Environment (DE). It is a Window manager so we want to add some extras.

Preparation

We want to make sure that we cannot destroy openbox by editing the different files so we make a directory for that:

mkdir -p ~/.config/openbox

Now we want to copy the files to this location that takes precedence over the default location:

cp /etc/xdg/openbox/{rc.xml,menu.xml,autostart,environment} ~/.config/openbox

We now are ready to edit those files, and if you destroy your Openbox with wrong entries; you can simply repeat the command above and start all over again.

You are ready to log in to your Openbox,
Oblogin.png

and you will be met by a grey screen. If you right-click you will get the menu but you probably want to make it more functional

Configuring Openbox

Editing the menu and look

To edit the pre-installed menu that may or may not contain everything you have on your computer, you need to edit the file:

nano ~/.config/openbox/menu.xml

Use your favorite editor like gedit etc - nano is just an example.

Find the item label that you want to edit and place the command to start the program between the <command> tags like this:

<command>gedit</command>

You can right-click and start the obconf menu editor from the system menu and alter the look and feel there:

Obconf.png

Making an auto working menu that reflects your entire system

It is tiresome to adjust your menu manually after having installed new software so it is better to make a menu that reflects all of your installed software and also gets updated for every new software install. For Mageia 4 this is how we do it: go to ~/.config/openbox and write this command in a terminal:

xdg_menu --format openbox3 --root-menu /etc/xdg/menus/applications.menu >xdg-menu.xml

This will generate the file xdg-menu.xml in your ~/.config/openbox directory. Open the file and find menu id="<Applications_in_your_language>"
~/.config/openbox/xdg-menu.xml

<?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="xdg" label="xdg">
#Here is the part to copy and paste into menu.xml 
<menu id="Programmer" label="Programmer"> <--------------------------------------------------------------------------- (Applications in Norwegian)
...

Now that we have found the koresponding name for "Applications" in our language we need to edit that into the present menu.xml: nano ~/.config/openbox/menu.xml
menu.xml

<?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">
   <menu id="Programmer" /> <-----------replace Applications here with the corresponding word in your language ("Progammer" in this case)
   <separator />
   <menu id="client-list-menu" />
   <separator />
   <menu id="ob-menu" label="System">
    <item label="Configure Openbox"><action name="Execute"><execute>obconf</$
    <item label="Reload Openbox"><action name="Reconfigure" /></item>
    <item label="Configure your Computer"><action name="Execute"><execute>mc$
   </menu>
   <separator />
   <item label="Log Out"><action name="Exit" /></item>
</menu>
</openbox_menu>

When finished go to a terminal and write: openbox --reconfigure And right-click on your desktop..and behold; the magic has happened.

Mxdgmenu.png


For Mageia 3 you can still use the following method but not for Mageia 4:

For x86-64 arch you can download and directly install openbox-menu (Mageia3 only)

For i586 you can download and install this openbox-menu (Mageia 3 only)

This installs obenbox-menu with dependencies.

We need to replace ~/.config/openbox/menu.xml with this:

menu.xml

<?xml version="1.0" encoding="UTF-8"?>
<openbox_menu xmlns="http://openbox.org/3.4/menu">
<menu id="desktop-app-menu" label="Applications" execute="openbox-menu"/>
<menu id="root-menu" label="Openbox 3">
<separator label="Menu"/>
<menu id="desktop-app-menu"/>
<separator label="Favorites"/>
<item label="Firefox">
<action name="Execute">
<command>firefox http://bjoernvold.com/forum</command>
</action>
</item>
<item label="Konsole">
<action name="Execute">
<command>konsole</command>
</action>
</item>
<item label="Control panel">
<action name="Execute">
<command>mcc</command>
</action>
</item>
<separator label="Openbox"/>
<item label="Configuration">
<action name="Execute">
<command>obconf</command>
</action>
</item>
<item label="Configure panel">
<action name="Execute">
<command>tint2conf</command>
</action>
</item>
<item label="Reconfigure openbox">
<action name="Reconfigure"/>
</item>
<separator label="Session"/>
<item label="Exit">
<action name="Execute">
<command>openbox --exit</command>
</action>
</item>
</menu>
</openbox_menu> 

This is only a working suggestion - you may edit the file to reflect your needs. Now you can right-click on your desktop and pick reconfigure openbox from your menu, or write openbox --reconfigure in your konsole/terminal.

Your new menu will reflect everything that you have installed and automatically add new installs to the menu.

Automenu.png

Adding/changing the background

To add a background simply do this: feh --bg-scale /home/user/pictures/your_pic.png

Where you change "user" and "pictures" and "your_pic.png" to your path and data.

Autostart

To make all the configuration stick and preserve the settings; we need to autostart some of the programs that we have used here. To achieve that, we open the file ~/.config/openbox/autostart and add this at the bottom of the file:


sh ~/.fehbg &
xcompmgr -c &
tint2 &
parcellite &

You can autostart any program you like here just remember the & after each line.

Assigning keys

You can assign programs like gmrun to the key combination ALT+F2 in ~/.config/openbox/rc.xml it will look like this:

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

To add window snap functionality to your openbox installation you can use this to assign Superkey/CTRL + Arrows:

   <keybind key="W-Left">        # HalfLeftScreen
     <action name="UnmaximizeFull"/>
     <action name="MoveResizeTo">
       <x>0</x>
       <y>0</y>
       <height>100%</height>
       <width>50%</width>
     </action>
   </keybind>
   <keybind key="W-Right">        # HalfRightScreen
     <action name="UnmaximizeFull"/>
     <action name="MoveResizeTo">
       <x>-0</x>
       <y>0</y>
       <height>100%</height>
       <width>50%</width>
     </action>
   </keybind>
   <keybind key="W-Up">        # HalfUpperScreen
     <action name="UnmaximizeFull"/>
     <action name="MoveResizeTo">
       <x>0</x>
       <y>0</y>
       <width>100%</width>
       <height>50%</height>
     </action>
   </keybind>
   <keybind key="W-Down">        # HalfLowerScreen
     <action name="UnmaximizeFull"/>
     <action name="MoveResizeTo">
       <x>0</x>
       <y>-0</y>
       <width>100%</width>
       <height>50%</height>
     </action>
   </keybind>
   <keybind key="C-Left">        # QuartLowerLeftScreen
     <action name="UnmaximizeFull"/>
     <action name="MoveResizeTo">
       <x>0</x>
       <y>-0</y>
       <width>50%</width>
       <height>50%</height>
     </action>
   </keybind>
   <keybind key="C-Right">        # QuartUpperRightScreen
     <action name="UnmaximizeFull"/>
     <action name="MoveResizeTo">
       <x>-0</x>
       <y>0</y>
       <width>50%</width>
       <height>50%</height>
     </action>
   </keybind>
   <keybind key="C-Up">        # QuartUpperLeftScreen
     <action name="UnmaximizeFull"/>
     <action name="MoveResizeTo">
       <x>0</x>
       <y>0</y>
       <width>50%</width>
       <height>50%</height>
     </action>
   </keybind>
   <keybind key="C-Down">        # QuartLowerRightScreen
     <action name="UnmaximizeFull"/>
     <action name="MoveResizeTo">
       <x>-0</x>
       <y>-0</y>
       <width>50%</width>
       <height>50%</height>
     </action>
   </keybind>
   <keybind key="A-Right">        # FullScreen
     <action name="UnmaximizeFull"/>
     <action name="MoveResizeTo">
       <x>0</x>
       <y>0</y>
       <width>100%</width>
       <height>100%</height>
     </action>
   </keybind>
   <keybind key="A-Left">        # MiddleScreen
     <action name="UnmaximizeFull"/>
     <action name="MoveResizeTo">
       <x>center</x>
       <y>center</y>
       <width>50%</width>
       <height>50%</height>
     </action>
   </keybind>

If you want to add ksnapshot (KDE) to your print screen key -find this and alter between the <command> tags:

      <keybind key="Print">
        <action name="Execute">
          <command>ksnapshot</command>
        </action>
      </keybind>

You would alter ksnapshot above to gnome-screenshot if you are used to Gnome. And if you want a delay for 5 seconds: gnome-screenshot -d 5

Adding a dock

There are several docks that can be used but we will use docky. You can use Cairo-dock too.

Docky is in the Mageia repos so you only have to install it and add docky & to your ~/.config/openbox/autostart file.

By now your autostart file could look something like this:

#
# These things are run when an Openbox X Session is started.
# You may place a similar script in $HOME/.config/openbox/autostart
# to run user-specific things.
#

# If you want to use GNOME config tools...
#
#if test -x /usr/libexec/gnome-settings-daemon >/dev/null; then
#  /usr/libexec/gnome-settings-daemon &
#elif which gnome-settings-daemon >/dev/null; then
#  gnome-settings-daemon &
#fi

# If you want to use XFCE config tools...
#
#xfce-mcs-manager &
sh ~/.fehbg &
xcompmgr -c &
tint2 &
parcellite &
docky &

If you "dual boot" openbox with KDE; docky will also turn up in your KDE environment - and you probably do not want that! To fix that you need to remove docky from the KDE autostart like this: rm ~/.config/autostart/docky.desktop It is perfectly safe to do so - just remove it!