OpenBox

From Pandora Wiki
Revision as of 07:08, 31 October 2013 by Kingu (talk | contribs) (added intro)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
openbox logo

Introduction

Openbox is a highly configurable, next generation window manager with extensive standards support. OpenBox is lightweight and very fast. Pnd download here [[1]]


Openbox for the Pandora aims to provide a GUI that's quick, responsive, and highly configurable. The PND (Switch GUI: Openbox) installs a number of components - namely: the window manager itself; the "Warlock Bar" for launching PNDs you've placed in pandora/apps or pandora/menu, and "tint2" - a panel that provides a taskbar, system tray, clock, and battery indicator. Configuration for each component is typically done by editing text files, or by using a graphical application that will edit the files for you, and let you preview the results.

OpenboxScreenshot.png

Configuring the Window Manager

Openbox lets you assign key and/or mouse events with actions. By default, the following are defined:

  • Root Menu: "Pandora Key" or "Right-Nub-Right-Click"
  • Go To Desktop 1: Alt DPAD-left
  • Go To Desktop 2: Alt DPAD-right
  • Send To Desktop 1: Ctrl DPAD-left
  • Send To Desktop 2: Ctrol DPAD-right
  • Client Menu: Alt DPAD-up
  • Switch Applications: Alt DPAD-down
  • Toggle Maximize: Ctrl DPAD-up
  • Toggle Shade: Ctrl DPAD-down
  • Quit Application: Ctrl-q
  • Long press on "Pandora Key": a kill menu

You can add more by editing $XDG_CONFIG_HOME/openbox/rc.xml (Root Menu -> Config -> Edit rc.xml - keybinding start around line 177). Additional keybindings from CountOrlock's setup are here: OpenBox#rc.xml

You can also define exactly how each application is launched. Line 660 onwards of rc.xml shows that XFCE's terminal is always launched maximized, and - commented out - how jumanji can be launched fullscreen, and how the size, position and appearance of applications can be controlled.

The contents Root Menu is defined in $XDG_CONFIG_HOME/openbox/menu.xml (Choose Root Menu -> Config -> Edit menu.xml). You can remove submenus and shortcuts you don't need, and add ones you do - as exemplified by CountOrlock's additions OpenBox#menu.xml

After making your changes and saving the file, reconfigure openbox (Root Menu -> Config -> Reconfigure) to see the results.

The graphical application for configuring the window manager is called obconf, and is accessed via Root Menu -> Config -> Config Manager. Amongst other things, this lets you choose and preview an Openbox theme. Openbox themes (as distinct from GTK+ themes), control the appearence of the Root Menu, application window frames (but not the contents), and buttons such as Maximize and Close. Additional themes can be downloaded from sites such as http://box-look.org - they are typically packaged in the ".obt "achive file understood by obconf.

Configuring GTK+ Applications

The appearance of GTK+ applications such as Mousepad and Geany are controlled by GTk+ engines and themes, the choice of which is determined in the $HOME/.gtkrc-2.0 file. This file can be manipulated by choosing Root Menu -> Config -> GTK+ Theme Switcher. GTK+ themes control the contents of application windows - the scrollbar, the colours, and the menu items. If you want to extend a theme, you can edit $HOME/.gtkrc.mine - the file placed there by default shows how to make scrollbars bigger as an example.

Configuring the Panel

By default, the tint2 panel is started along with the window manager. To change this, edit $XDG_CONFIG_HOME/openbox/autostart (Root Menu -> Config -> Edit autostart). You can also change whether it appears or not via Root Menu -> Toggle Tint2 Panel. The graphical application for configuration is launched by choosing Root Menu -> Config -> Tint2 Panel Wizard. Interesting options can be found in Panel -> Panel Display (to move the panel to the bottom of the screen for example); Panel -> Panel Autohide (to choose whether the panel only appears when you mouseover its area, to give you the maximum screen real estate for applications), and in Launchers. There's 3 slots for application launchers, with a Root Menu launcher in slot 1 by default. To add a launcher for a PND, add the path to it's desktop file (e.g. /usr/share/applications/hdonk_firefox_001#0.desktop) to one of the slots. You can also create your own desktop files for custom actions, e.g. launching the File Manager for the root of a SD card:

[Desktop Entry]
Name=Show SD 1 Contents
Type=Application
Version=1.0
Icon=/usr/share/icons/gnome/32x32/devices/gnome-dev-media-sdmmc.png
Exec=Thunar /media/mmcblk0p1

Save this text in a file called $XDG_CONFIG_HOME/tint2/showSD1.desktop and add this path to one of the launcher slots.

Configuring the Warlock Bar

By default, the Warlock Bar is started along with the window manager. To change this, edit $XDG_CONFIG_HOME/openbox/autostart (Root Menu -> Config -> Edit autostart). You can also change whether it appears or not via Root Menu -> Toggle Warlock Bar. The bar's contents are auto-generated at startup by merging the file at $XDG_CONFIG_HOME/openbox/wbar_custom.cfg with a config created from the PNDs installed in pandora/apps or pandora/desktop (or - more accurately, it's created from the .desktop files in $HOME/Desktop). You can add or remove other entries by choosing Root Menu -> Config -> Edit wbar_custom.cfg, and change it's appearance by editing the first entry in that file (e.g. changing the second line to "c: wbar --bpress --pos right --vbar --isize 48 --idist 15 --nanim 4 --falfa 65" would put a vertical bar on the right of the screen). After making changes, choose Root Menu -> Config -> Reload Warlock bar to see them.

CountOrlock Config

rc.xml

This a work in process config, so please be aware that you use it at your own risk. Here is the main bindings:

  • Root Menu: "Pandora Key"
  • Window Listing and Desktop Management Menu: Shift "Pandora Key"
  • Client Menu: Ctrl Space
  • Next Window: Ctrl DPAD-Right
  • Previous Window: Ctrl DPAD-Left
  • Toggle Maximize: Ctrl DPAD-up
  • Toggle FullScreen (No Decoration): Ctrl o
  • Toggle Desktop: Ctrl u
  • Window on left side : Ctrl j
  • Window on right side : Ctrl k
  • Window on half top : Ctrl i
  • Window on half bottom : Ctrl m
  • Quit Application: Ctrl-q
  • Launch urxvt : Ctrl Shift t
  • Launch Thunar : Ctrl Shift f
  • Launch FireFox : Ctrl Shift w
  • Launch mousepad : Ctrl Shift e
  • Launch mplayer : Ctrl Shift m

And this is the content of keyboard section in the rc.xml, make a backup of your config before tying this :

  <keyboard>
    <!-- Pandora keybindings start -->
    <!-- Keybinding for root menu (Pandora button) -->
    <keybind key="C-XF86MenuKB">
      <action name="ShowMenu">
        <menu>root-menu</menu>
      </action>
    </keybind>
    <keybind key="S-XF86MenuKB">
      <action name="ShowMenu">
        <menu>client-list-combined-menu</menu>
      </action>
    </keybind>
    <!-- Keybindings for window related stuff -->
    <keybind key="C-Up"> 
      <action name="ToggleMaximizeFull">
      <finalactions>
        <action name="Focus"/>
        <action name="Raise"/>
        <action name="Unshade"/>
      </finalactions>
      </action>
    </keybind>
    <keybind key="C-Down">
      <action name="Iconify">
      </action>
    </keybind>
    <keybind key="C-o">
      <action name="ToggleFullscreen">
      </action>
    </keybind>
    <keybind key="C-u">
      <action name="ToggleShowDesktop"/>
    </keybind>
    <keybind key="C-Left">
        <action name="PreviousWindow">
        <finalactions>
          <action name="Focus"/>
          <action name="Raise"/>
          <action name="Unshade"/>
        </finalactions>
      </action>
    </keybind>
    <keybind key="C-Right">
      <action name="NextWindow">
        <finalactions>
          <action name="Focus"/>
          <action name="Raise"/>
          <action name="Unshade"/>
        </finalactions>
      </action>
    </keybind>
    <keybind key="C-q">
      <action name="Close"/>
    </keybind>
    <keybind key="C-space">
      <action name="ShowMenu">
        <menu>client-menu</menu>
      </action>
    </keybind>
    <!-- Keybindings for pseudo tiling windows manager-->
    <keybind key="C-k">
      <action name="MoveResizeTo">
        <x>-0</x>
        <y>0</y>
        <width>50%</width>
        <height>460</height>
        <finalactions>
          <action name="Unmaximize"/>
          <action name="Focus"/>
          <action name="Raise"/>
          <action name="Unshade"/>
        </finalactions>
      </action>
    </keybind>
    <keybind key="C-j">
      <action name="MoveResizeTo">
        <x>0</x>
        <y>0</y>
        <width>50%</width>
        <height>460</height>
        <finalactions>
          <action name="Unmaximize"/>
          <action name="Focus"/>
          <action name="Raise"/>
          <action name="Unshade"/>
        </finalactions>
      </action>
    </keybind>
    <keybind key="C-i">
      <action name="MoveResizeTo">
        <x>0</x>
        <y>0</y>
        <width>100%</width>
        <height>230</height>
        <finalactions>
          <action name="Unmaximize"/>
          <action name="Focus"/>
          <action name="Raise"/>
          <action name="Unshade"/>
        </finalactions>
      </action>
    </keybind>
    <keybind key="C-m">
      <action name="MoveResizeTo">
        <x>0</x>
        <y>-0</y>
        <width>100%</width>
        <height>230</height>
        <finalactions>
          <action name="Unmaximize"/>
          <action name="Focus"/>
          <action name="Raise"/>
          <action name="Unshade"/>
        </finalactions>
      </action>
    </keybind>
    <!-- Keybindings for Quick Launch -->
    <keybind key="C-S-t">
      <action name="Execute">
        <command>urxvt -title "Pandora Term"</command> 
      </action>
    </keybind>
    <keybind key="C-S-e">
      <action name="Execute">
        <command>mousepad</command> 
      </action>
    </keybind>
    <keybind key="C-S-m">
      <action name="Execute">
        <command>pnd_run /media/<YOUR_SD_CARD_NAME_HERE>/pandora/apps/smplayer2_r6.pnd</command> 
      </action>
    </keybind>
    <keybind key="C-S-w">
      <action name="Execute">
        <command>pnd_run /media/<YOUR_SD_CARD_NAME_HERE>/pandora/apps/firefox-17.0.1-1.pnd</command> 
      </action>
    </keybind>
    <keybind key="C-S-f">
      <action name="Execute">
        <command>thunar</command> 
      </action>
    </keybind>
    <!-- Pandora keybindings end -->
  </keyboard>
 

menu.xml

Menu changed to get easy access to config files as I spend a lot of time tuning them. And also some new stuff:

  • "Pandora Setting" menu: Wifi on/off, BT etc.
  • "OpenBox Tools" menu: toggle tint2, warlock Bar.
  • Direct cast a term
  • Direct cast an editor
  • Direct cast a Web Browser
  • Direct cast a FileManager
  • Direct cast a PNDManager
<?xml version="1.0" encoding="UTF-8"?>

<openbox_menu xmlns="http://openbox.org/3.4/menu">

<menu id="PNDs-menu"
	label="PNDs"
	execute="openbox-menu /etc/xdg/menus/openbox-pnd.menu" />

<menu id="Config-menu"
	label="Config"
	execute="openbox-functions configmenu" />

<menu id="root-menu" label="Openbox 3">
	<menu id="PNDs-menu" />
	<separator />

	<menu id="Config-menu" />
	<separator />	

        <menu id="PandoraSettings" label="Pandora Settings">	
        <item label="Toggle Bluetooth" icon="/usr/share/icons/hicolor/32x32/apps/bluetooth.png">
    	<action name="Execute">
    		<command>/usr/pandora/scripts/op_bluetooth.sh</command>
    	</action>
  	</item>    

	<item label="Toggle WiFi" icon="/usr/share/icons/openbox/wifi.png">
    	<action name="Execute">
    		<command>/usr/pandora/scripts/pnd_run.sh -p "/usr/pandora/apps/op_wifi.pnd" -e "op_wifi.sh" -b "op_wifi"</command>
    	</action>
  	</item>

	<item label="Edit Connections" icon="/usr/share/icons/gnome/32x32/status/network-idle.png">
    	<action name="Execute">
    		<command>nm-connection-editor</command>
    	</action>
  	</item>

  	<item label="Auto Connect" icon="/usr/share/icons/gnome/32x32/status/network-transmit.png">
    	<action name="Execute">
    		<command>openbox-functions autoconnect</command>
    	</action>
  	</item>    

	<separator />
   	<item label="Toggle USB Host" icon="/usr/share/icons/openbox/op_usbhost.png">
    	<action name="Execute">
      		<command>/usr/pandora/scripts/pnd_run.sh -p "/usr/pandora/apps/op_usbhost.pnd" -e "op_usbhost.sh" -b "op_usbhost"</command>
    	</action>
	</item>
   	<item label="SD-Mass Storage" icon="/usr/share/icons/openbox/op_storage.png">
    	<action name="Execute">
      		<command>/usr/pandora/scripts/pnd_run.sh -p "/usr/pandora/apps/op_storage.pnd" -e "op_storage.sh" -b "op_storage"</command>
    	</action>
	</item>
        </menu>

	<separator />

        <menu id="OpenBox-tools" label="OpenBox Tools">
	<item label="Toggle Tint2 Panel" icon="/usr/share/icons/gnome/32x32/actions/remove.png">
    	<action name="Execute">
      		<command>openbox-functions toggletint2</command>
    	</action>
	</item>
	<item label="Toggle Warlock Bar" icon="/usr/share/pixmaps/wbar/wbar.png">
    	<action name="Execute">
      		<command>openbox-functions togglewbar</command>
    	</action>
	</item>      	
        </menu>

	<separator />
	<item label="PND Manager" icon="/usr/share/icons/gnome/32x32/status/software-update-available.png">
	<action name="Execute">
		<command>pnd_run /media/<YOUR_SD_CARD_NAME_HERE>/pandora/menu/pndmanager.pnd </command>
	</action>
  	</item>    

  	<item label="Editor" icon="/usr/share/icons/hicolor/24x24/apps/Mousepad.png">
    	<action name="Execute">
      		<command>mousepad</command>
    	</action>
  	</item>    

  	<item label="File Manager" icon="/usr/share/icons/gnome/32x32/apps/system-file-manager.png">
    	<action name="Execute">
      		<command>Thunar</command>
    	</action>
  	</item>    

  	<item label="Browser" icon="/usr/share/icons/gnome/24x24/apps/web-browser.png">
    	<action name="Execute">
      		<command>pnd_run /media/<YOUR_SD_CARD_NAME_HERE>/pandora/apps/firefox-17.0.1-1.pnd</command>
    	</action>
  	</item>    

  	<item label="Terminal" icon="/usr/share/icons/gnome/32x32/apps/utilities-terminal.png">
    	<action name="Execute">
                <command>urxvt -title "Pandora Term"</command>
    	</action>
  	</item>    
  	<separator />
  
  	<item label="Switch GUI" icon="/usr/share/icons/openbox/switchgui.png">
    	<action name="Execute">
      		<command>/usr/pandora/scripts/op_switchgui.sh</command>
    	</action>
  	</item>

  	<item label="Shutdown">
    	<action name="Execute">
      		<command>sudo shutdown -h now </command>
    	</action>
  	</item>

</menu>

</openbox_menu>