You are not logged in.

#376 2008-10-14 14:49:36

joqueza
Member
Registered: 2008-08-16
Posts: 58

Re: Share your Openbox Desktop ! :)

once I get back home I will hook it up

btw, even setting conky as "override" and setting, in ob application section, "<layer>above</layer>" I can't get it to work as a desktop bar... any clues?

Offline

#377 2008-10-14 19:57:52

ArchArael
Member
Registered: 2005-06-14
Posts: 504

Re: Share your Openbox Desktop ! :)

None response from wimac so I searched for his wallpaper on google.

If someone is interested in just click here: http://www.fresh-paper.com/fresh-paper. … per-34.jpg

Enjoy wink

Last edited by ArchArael (2008-10-14 19:58:26)

Offline

#378 2008-10-14 21:58:37

joqueza
Member
Registered: 2008-08-16
Posts: 58

Re: Share your Openbox Desktop ! :)

moljac024 wrote:
joqueza wrote:

http://img413.imageshack.us/img413/1909 … du2.th.pnghttp://img413.imageshack.us/images/thpix.gif

openbox, pypanel, netwmpager, conky and some scripts.

damn conky is a resource hog.

Awesome wallpaper! Link ? smile

I uploaded it to you... here it is buddy

pacmangq8.th.jpgthpix.gif

Offline

#379 2008-10-15 16:37:51

securitybreach
Member
From: In front of my computers
Registered: 2007-11-18
Posts: 416
Website

Re: Share your Openbox Desktop ! :)

Here is my newest OpenBox screenshot with the following running:

OpenBox 3.4.7.2
Conky-nvidia 1.6.1-1
Irssi 0.8.12
Firefox 3.0.3
Terminal 0.2.8
PCMan File Mananger 0.5
Ipager 1.1.0-6
Htop 0.8-2

Openbox Theme: Mire_v2_grey
GTK Theme: Royalty
Icon Theme: G-Flat-Svg

200810151227481680x1050lg6.th.pngthpix.gif


OpenBox rc.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!-- Do not edit this file, it will be overwritten on install.
        Copy the file to $HOME/.config/openbox/ instead. -->
<openbox_config xmlns="http://openbox.org/3.4/rc">
  <resistance>
    <strength>10</strength>
    <screen_edge_strength>20</screen_edge_strength>
  </resistance>
  <focus>
    <focusNew>yes</focusNew>
    <!-- always try to focus new windows when they appear. other rules do
       apply -->
    <followMouse>no</followMouse>
    <!-- move focus to a window when you move the mouse into it -->
    <focusLast>yes</focusLast>
    <!-- focus the last used window when changing desktops, instead of the one
       under the mouse pointer. when followMouse is enabled -->
    <underMouse>no</underMouse>
    <!-- move focus under the mouse, even when the mouse is not moving -->
    <focusDelay>200</focusDelay>
    <!-- when followMouse is enabled, the mouse must be inside the window for
       this many milliseconds (1000 = 1 sec) before moving focus to it -->
    <raiseOnFocus>no</raiseOnFocus>
    <!-- when followMouse is enabled, and a window is given focus by moving the
       mouse into it, also raise the window -->
  </focus>
  <placement>
    <policy>Smart</policy>
    <!-- 'Smart' or 'UnderMouse' -->
    <center>yes</center>
    <!-- whether to place windows in the center of the free area found or
       the top left corner -->
    <monitor>Any</monitor>
    <!-- with Smart placement on a multi-monitor system, try to place new windows
       on: 'Any' - any monitor, 'Mouse' - where the mouse is, 'Active' - where
       the active window is -->
  </placement>
  <theme>
    <name>Mire_v2_grey</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).
  -->
    <keepBorder>yes</keepBorder>
    <animateIconify>yes</animateIconify>
    <font place="ActiveWindow">
      <name>snap</name>
      <size>6</size>
      <!-- font size in points -->
      <weight>Normal</weight>
      <!-- 'bold' or 'normal' -->
      <slant>Normal</slant>
      <!-- 'italic' or 'normal' -->
    </font>
    <font place="InactiveWindow">
      <name>snap</name>
      <size>6</size>
      <!-- font size in points -->
      <weight>Normal</weight>
      <!-- 'bold' or 'normal' -->
      <slant>Normal</slant>
      <!-- 'italic' or 'normal' -->
    </font>
    <font place="MenuHeader">
      <name>Terminal</name>
      <size>7</size>
      <!-- font size in points -->
      <weight>Bold</weight>
      <!-- 'bold' or 'normal' -->
      <slant>Normal</slant>
      <!-- 'italic' or 'normal' -->
    </font>
    <font place="MenuItem">
      <name>Terminal</name>
      <size>7</size>
      <!-- font size in points -->
      <weight>Bold</weight>
      <!-- 'bold' or 'normal' -->
      <slant>Normal</slant>
      <!-- 'italic' or 'normal' -->
    </font>
    <font place="OnScreenDisplay">
      <name>Terminal</name>
      <size>9</size>
      <!-- font size in points -->
      <weight>Bold</weight>
      <!-- 'bold' or 'normal' -->
      <slant>Normal</slant>
      <!-- 'italic' or 'normal' -->
    </font>
  </theme>
  <desktops>
    <!-- this stuff is only used at startup, pagers allow you to change them
       during a session

       these are default values to use when other ones are not already set
       by other applications, or saved in your session

       use obconf if you want to change these without having to log out
       and back in -->
    <number>4</number>
    <firstdesk>1</firstdesk>
    <names>
      <name>I</name>
      <name>II</name>
      <name>III</name>
      <name>IV</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>
  <resize>
    <drawContents>yes</drawContents>
    <popupShow>Nonpixel</popupShow>
    <!-- 'Always', 'Never', or 'Nonpixel' (xterms and such) -->
    <popupPosition>Center</popupPosition>
    <!-- 'Center', 'Top', or 'Fixed' -->
    <popupFixedPosition>
      <!-- these are used if popupPosition is set to 'Fixed' -->
      <x>10</x>
      <!-- positive number for distance from left edge, negative number for
         distance from right edge, or 'Center' -->
      <y>10</y>
      <!-- positive number for distance from top edge, negative number for
         distance from bottom edge, or 'Center' -->
    </popupFixedPosition>
  </resize>
  <!-- You can reserve a portion of your screen where windows will not cover when
     they are maximized, or when they are initially placed.
     Many programs reserve space automatically, but you can use this in other
     cases. -->
  <margins>
    <top>0</top>
    <bottom>0</bottom>
    <left>0</left>
    <right>0</right>
  </margins>
  <dock>
    <position>TopLeft</position>
    <!-- (Top|Bottom)(Left|Right|)|Top|Bottom|Left|Right|Floating -->
    <floatingX>0</floatingX>
    <floatingY>0</floatingY>
    <noStrut>no</noStrut>
    <stacking>Above</stacking>
    <!-- 'Above', 'Normal', or 'Below' -->
    <direction>Vertical</direction>
    <!-- 'Vertical' or 'Horizontal' -->
    <autoHide>no</autoHide>
    <hideDelay>300</hideDelay>
    <!-- in milliseconds (1000 = 1 second) -->
    <showDelay>300</showDelay>
    <!-- in milliseconds (1000 = 1 second) -->
    <moveButton>Middle</moveButton>
    <!-- 'Left', 'Middle', 'Right' -->
  </dock>
  <keyboard>
    <chainQuitKey>C-g</chainQuitKey>
    <!-- Keybindings for desktop switching -->
    <keybind key="C-A-Left">
      <action name="DesktopLeft">
        <dialog>no</dialog>
        <wrap>no</wrap>
      </action>
    </keybind>
    <keybind key="C-A-Right">
      <action name="DesktopRight">
        <dialog>no</dialog>
        <wrap>no</wrap>
      </action>
    </keybind>
    <keybind key="C-A-Up">
      <action name="DesktopUp">
        <dialog>no</dialog>
        <wrap>no</wrap>
      </action>
    </keybind>
    <keybind key="C-A-Down">
      <action name="DesktopDown">
        <dialog>no</dialog>
        <wrap>no</wrap>
      </action>
    </keybind>
    <keybind key="S-A-Left">
      <action name="SendToDesktopLeft">
        <dialog>no</dialog>
        <wrap>no</wrap>
      </action>
    </keybind>
    <keybind key="S-A-Right">
      <action name="SendToDesktopRight">
        <dialog>no</dialog>
        <wrap>no</wrap>
      </action>
    </keybind>
    <keybind key="S-A-Up">
      <action name="SendToDesktopUp">
        <dialog>no</dialog>
        <wrap>no</wrap>
      </action>
    </keybind>
    <keybind key="S-A-Down">
      <action name="SendToDesktopDown">
        <dialog>no</dialog>
        <wrap>no</wrap>
      </action>
    </keybind>
    <keybind key="W-F1">
      <action name="Desktop">
        <desktop>1</desktop>
      </action>
    </keybind>
    <keybind key="W-F2">
      <action name="Desktop">
        <desktop>2</desktop>
      </action>
    </keybind>
    <keybind key="W-F3">
      <action name="Desktop">
        <desktop>3</desktop>
      </action>
    </keybind>
    <keybind key="W-F4">
      <action name="Desktop">
        <desktop>4</desktop>
      </action>
    </keybind>
    <keybind key="W-d">
      <action name="ToggleShowDesktop"/>
    </keybind>
    <keybind key="A-F2">
      <action name="execute">
        <execute>gmrun</execute>
      </action>
    </keybind>
    <keybind key="C-t">
      <action name="execute">
        <execute>terminal --hide-borders</execute>
      </action>
    </keybind>
    <keybind key="C-e">
      <action name="execute">
        <execute>pcmanfm</execute>
      </action>
    </keybind>
    <keybind key="W-d">
      <action name="ToggleShowDesktop"/>
    </keybind>
    <!-- Keybindings for windows -->
    <keybind key="A-F4">
      <action name="Close"/>
    </keybind>
    <keybind key="A-Escape">
      <action name="Lower"/>
      <action name="FocusToBottom"/>
      <action name="Unfocus"/>
    </keybind>
    <keybind key="A-space">
      <action name="ShowMenu">
        <menu>client-menu</menu>
      </action>
    </keybind>
    <!-- Keybindings for window switching -->
    <keybind key="A-Tab">
      <action name="NextWindow"/>
    </keybind>
    <keybind key="A-S-Tab">
      <action name="PreviousWindow"/>
    </keybind>
    <keybind key="C-A-Tab">
      <action name="NextWindow">
        <panels>yes</panels>
        <desktop>yes</desktop>
      </action>
    </keybind>
    <!-- Keybindings for running applications -->
    <keybind key="W-e">
      <action name="Execute">
        <startupnotify>
          <enabled>true</enabled>
          <name>Konqueror</name>
        </startupnotify>
        <command>kfmclient openProfile filemanagement</command>
      </action>
    </keybind>
  </keyboard>
  <mouse>
    <dragThreshold>8</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 -->
    <context name="Frame">
      <mousebind button="A-Left" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
      </mousebind>
      <mousebind button="A-Left" action="Click">
        <action name="Unshade"/>
      </mousebind>
      <mousebind button="A-Left" action="Drag">
        <action name="Move"/>
      </mousebind>
      <mousebind button="A-Right" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
        <action name="Unshade"/>
      </mousebind>
      <mousebind button="A-Right" action="Drag">
        <action name="Resize"/>
      </mousebind>
      <mousebind button="A-Middle" action="Press">
        <action name="Lower"/>
        <action name="FocusToBottom"/>
        <action name="Unfocus"/>
      </mousebind>
      <mousebind button="A-Up" action="Click">
        <action name="DesktopPrevious"/>
      </mousebind>
      <mousebind button="A-Down" action="Click">
        <action name="DesktopNext"/>
      </mousebind>
      <mousebind button="C-A-Up" action="Click">
        <action name="DesktopPrevious"/>
      </mousebind>
      <mousebind button="C-A-Down" action="Click">
        <action name="DesktopNext"/>
      </mousebind>
      <mousebind button="A-S-Up" action="Click">
        <action name="SendToDesktopPrevious"/>
      </mousebind>
      <mousebind button="A-S-Down" action="Click">
        <action name="SendToDesktopNext"/>
      </mousebind>
    </context>
    <context name="Titlebar">
      <mousebind button="Left" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
      </mousebind>
      <mousebind button="Left" action="Drag">
        <action name="Move"/>
      </mousebind>
      <mousebind button="Left" action="DoubleClick">
        <action name="ToggleMaximizeFull"/>
      </mousebind>
      <mousebind button="Middle" action="Press">
        <action name="Lower"/>
        <action name="FocusToBottom"/>
        <action name="Unfocus"/>
      </mousebind>
      <mousebind button="Middle" action="Click">
        <action name="Shade"/>
        <action name="FocusToBottom"/>
        <action name="Unfocus"/>
        <action name="Lower"/>
      </mousebind>
      <mousebind button="Right" action="DoubleClick">
        <action name="Unshade"/>
        <action name="Raise"/>
      </mousebind>
      <mousebind button="Right" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
        <action name="ShowMenu">
          <menu>client-menu</menu>
        </action>
      </mousebind>
    </context>
    <context name="Top">
      <mousebind button="Left" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
        <action name="Unshade"/>
      </mousebind>
      <mousebind button="Left" action="Drag">
        <action name="Resize">
          <edge>top</edge>
        </action>
      </mousebind>
    </context>
    <context name="Left">
      <mousebind button="Left" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
      </mousebind>
      <mousebind button="Left" action="Drag">
        <action name="Resize">
          <edge>left</edge>
        </action>
      </mousebind>
    </context>
    <context name="Right">
      <mousebind button="Left" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
      </mousebind>
      <mousebind button="Left" action="Drag">
        <action name="Resize">
          <edge>right</edge>
        </action>
      </mousebind>
    </context>
    <context name="Bottom">
      <mousebind button="Left" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
      </mousebind>
      <mousebind button="Left" action="Drag">
        <action name="Resize">
          <edge>bottom</edge>
        </action>
      </mousebind>
      <mousebind button="Middle" action="Press">
        <action name="Lower"/>
        <action name="FocusToBottom"/>
        <action name="Unfocus"/>
      </mousebind>
      <mousebind button="Right" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
        <action name="ShowMenu">
          <menu>client-menu</menu>
        </action>
      </mousebind>
    </context>
    <context name="BLCorner">
      <mousebind button="Left" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
      </mousebind>
      <mousebind button="Left" action="Drag">
        <action name="Resize"/>
      </mousebind>
    </context>
    <context name="BRCorner">
      <mousebind button="Left" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
      </mousebind>
      <mousebind button="Left" action="Drag">
        <action name="Resize"/>
      </mousebind>
    </context>
    <context name="TLCorner">
      <mousebind button="Left" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
        <action name="Unshade"/>
      </mousebind>
      <mousebind button="Left" action="Drag">
        <action name="Resize"/>
      </mousebind>
    </context>
    <context name="TRCorner">
      <mousebind button="Left" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
        <action name="Unshade"/>
      </mousebind>
      <mousebind button="Left" action="Drag">
        <action name="Resize"/>
      </mousebind>
    </context>
    <context name="Client">
      <mousebind button="Left" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
      </mousebind>
      <mousebind button="Middle" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
      </mousebind>
      <mousebind button="Right" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
      </mousebind>
    </context>
    <context name="Icon">
      <mousebind button="Left" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
        <action name="Unshade"/>
        <action name="ShowMenu">
          <menu>client-menu</menu>
        </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="AllDesktops">
      <mousebind button="Left" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
        <action name="Unshade"/>
      </mousebind>
      <mousebind button="Left" action="Click">
        <action name="ToggleOmnipresent"/>
      </mousebind>
    </context>
    <context name="Shade">
      <mousebind button="Left" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
      </mousebind>
      <mousebind button="Left" action="Click">
        <action name="ToggleShade"/>
      </mousebind>
    </context>
    <context name="Iconify">
      <mousebind button="Left" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
      </mousebind>
      <mousebind button="Left" action="Click">
        <action name="Iconify"/>
      </mousebind>
    </context>
    <context name="Maximize">
      <mousebind button="Left" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
        <action name="Unshade"/>
      </mousebind>
      <mousebind button="Middle" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
        <action name="Unshade"/>
      </mousebind>
      <mousebind button="Right" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
        <action name="Unshade"/>
      </mousebind>
      <mousebind button="Left" action="Click">
        <action name="ToggleMaximizeFull"/>
      </mousebind>
      <mousebind button="Middle" action="Click">
        <action name="ToggleMaximizeVert"/>
      </mousebind>
      <mousebind button="Right" action="Click">
        <action name="ToggleMaximizeHorz"/>
      </mousebind>
    </context>
    <context name="Close">
      <mousebind button="Left" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
        <action name="Unshade"/>
      </mousebind>
      <mousebind button="Left" action="Click">
        <action name="Close"/>
      </mousebind>
    </context>
    <context name="Desktop">
      <mousebind button="Up" action="Click">
        <action name="DesktopPrevious"/>
      </mousebind>
      <mousebind button="Down" action="Click">
        <action name="DesktopNext"/>
      </mousebind>
      <mousebind button="A-Up" action="Click">
        <action name="DesktopPrevious"/>
      </mousebind>
      <mousebind button="A-Down" action="Click">
        <action name="DesktopNext"/>
      </mousebind>
      <mousebind button="C-A-Up" action="Click">
        <action name="DesktopPrevious"/>
      </mousebind>
      <mousebind button="C-A-Down" action="Click">
        <action name="DesktopNext"/>
      </mousebind>
      <mousebind button="Left" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
      </mousebind>
      <mousebind button="Right" action="Press">
        <action name="Focus"/>
        <action name="Raise"/>
      </mousebind>
    </context>
    <context name="Root">
      <!-- Menus -->
      <mousebind button="Middle" action="Press">
        <action name="ShowMenu">
          <menu>client-list-combined-menu</menu>
        </action>
      </mousebind>
      <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="DesktopPrevious"/>
      </mousebind>
      <mousebind button="Down" action="Click">
        <action name="DesktopNext"/>
      </mousebind>
      <mousebind button="A-Up" action="Click">
        <action name="DesktopPrevious"/>
      </mousebind>
      <mousebind button="A-Down" action="Click">
        <action name="DesktopNext"/>
      </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/) -->
    <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>
    <!-- this one is easy, time to delay before showing a submenu after hovering
       over the parent entry -->
    <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>
    <!--
  # this is an example with comments through out. use these to make your
  # own rules, but without the comments of course.

  <application name="first element of window's WM_CLASS property (see xprop)"
              class="second element of window's WM_CLASS property (see xprop)"
               role="the window's WM_WINDOW_ROLE property (see xprop)"
               type="the window's _NET_WM_WINDOW_TYPE (if unspecified, then
                       it is dialog for child windows)">
  # the name or the class can be set, or both. this is used to match
  # windows when they appear. role can optionally be set as well, to
  # further restrict your matches.

  # the name, class, and role use simple wildcard matching such as those
  # used by a shell. you can use * to match any characters and ? to match
  # any single character.

  # the type is one of: normal, dialog, splash, utility, menu, toolbar, dock,
  #    or desktop

  # when multiple rules match a window, they will all be applied, in the
  # order that they appear in this list


    # each element can be left out or set to 'default' to specify to not 
    # change that attribute of the window

    <decor>yes</decor>
    # enable or disable window decorations

    <shade>no</shade>
    # make the window shaded when it appears, or not

    <position force="no">
      # the position is only used if both an x and y coordinate are provided
      # (and not set to 'default')
      # when force is "yes", then the window will be placed here even if it
      # says you want it placed elsewhere.  this is to override buggy
      # applications who refuse to behave
      <x>center</x>
      # a number like 50, or 'center' to center on screen. use a negative number
      # to start from the right (or bottom for <y>), ie -50 is 50 pixels from the
      # right edge (or bottom).
      <y>200</y>
      <monitor>1</monitor>
      # specifies the monitor in a xinerama setup.
      # 1 is the first head, or 'mouse' for wherever the mouse is
    </position>

    <focus>yes</focus>
    # if the window should try be given focus when it appears. if this is set
    # to yes it doesn't guarantee the window will be given focus. some
    # restrictions may apply, but Openbox will try to

    <desktop>1</desktop>
    # 1 is the first desktop, 'all' for all desktops

    <layer>normal</layer>
    # 'above', 'normal', or 'below'

    <iconic>no</iconic>
    # make the window iconified when it appears, or not

    <skip_pager>no</skip_pager>
    # asks to not be shown in pagers

    <skip_taskbar>no</skip_taskbar>
    # asks to not be shown in taskbars. window cycling actions will also
    # skip past such windows

    <fullscreen>yes</fullscreen>
    # make the window in fullscreen mode when it appears

    <maximized>true</maximized>
    # 'Horizontal', 'Vertical' or boolean (yes/no)
  </application>

  # end of the example
-->
  </applications>
</openbox_config>

conkyrc

double_buffer yes
no_buffers yes
own_window yes
own_window_transparent yes
own_window_type desktop
own_window_hints undecorate,sticky,skip_taskbar,skip_pager

border_margin 1
draw_shades no
gap_x 1
gap_y 1
alignment top_right
update_interval 1

default_color D6D6D6
own_window_colour 202020

use_xft yes
xftfont Snap:pixelsize=10

use_spacer none
minimum_size 1278 12

mpd_host localhost
mpd_port 6600
# ${offset -22}
TEXT
                                                                                                                                  ${color white}${time  %H:%M}    ${color} P: ${color white}${font}${processes}${color} ${color white} ${color} RAM: ${color white}${font}${mem}${color} SWAP: ${color white}${font} ${swap} ${color white}  ${color} UPTIME: ${color white}${font}${uptime_short}${color white}     ${color white}${font}${downspeed eth0} Kb/s   ${color white}    ${color white}${upspeed eth0} Kb/s  ${color white}   ${color}/ ${color white}${font}${fs_free /} ${color} /home ${color white}${font}${fs_free /home} ${color white}                                                                                                           
                                                                                                                       ${color white}CPU1 Usage:${color} ${cpu cpu1}% ${freq cpu1}MHz   Load: ${loadavg}    Temp: ${color white} ${hwmon 1 temp 1}°C ${color white}                 ${color white}CPU2 Usage:${color} ${cpu cpu2}% ${freq cpu2}MHz   Load: ${loadavg}   Temp: ${color white} ${hwmon 2 temp 1}°C ${color white} 
                                                                                                                                 ${color white} Nvidia${color} ${color white} ${nvidia temp} C      ${color white} Motherboard ${color white}${hwmon 0 temp 1} °C      ${color white} Hostname: ${execi 30 hostname}        ${color white}MPD: ${font}${mpd_smart} ${alignr}

autostart.sh

             ## Run the system-wide support stuff
#.$GLOBALAUTOSTART

# Programs to launch at startup
feh --bg-scale /home/comhack/Pictures/backgrounds/Linux/11326-040311linux-elegant.png
#/usr/libexec/gnome-settings-daemon &
# SCIM support (for typing non-english characters)
# Programs that will run after Openbox has started
#(sleep 2 && pypanel) &
(sleep 2 && conky) &
(sleep 2 && /etc/X11/Xsession) &
(sleep 2 && /etc/X11/Xsession.d/92keytouchd_launch) &
#(sleep 2 && root-tail --color grey /var/log/everything.log) &
(sleep 2 && ipager) &

and .xinitrc:

#!/bin/sh

#
# ~/.xinitrc
#
# Executed by startx (run your window manager from here)
#
#exec startlxde
# exec gnome-session
#exec startkde
# exec startxfce4
# exec icewm
# exec blackbox
# exec fluxbox
# exec ratpoison
# exec dwm
# ... or any other WM of your choosing ...
xscreensaver -no-splash &
numlockx &
exec openbox-session
/etc/X11/Xsession

Thanks

Last edited by securitybreach (2008-10-15 17:03:01)


"Every normal man must be tempted at times to spit upon his hands, hoist the black flag, and begin slitting throats." -- H.L. Mencken
Website      Configs
Forum Admin: Bruno's All Things Linux   
securitybreach<a>archlinux.us

Offline

#380 2008-10-17 20:18:06

weakhead
Member
From: Poland
Registered: 2008-08-21
Posts: 341
Website

Re: Share your Openbox Desktop ! :)

.screen1.png
.screen2.png

OB theme: NodokaOrangeBlack
GTK2 theme: NodokaOrangeBlack
Icon theme: DeltaFar

Offline

#381 2008-10-21 20:20:52

froli
Member
From: Germany
Registered: 2008-06-17
Posts: 455

Re: Share your Openbox Desktop ! :)

2960941395_318928a586_m_d.jpg


archlinux on Macbook Pro 10,1

Offline

#382 2008-10-21 20:42:28

Renan Birck
Member
From: Brazil
Registered: 2007-11-11
Posts: 401
Website

Re: Share your Openbox Desktop ! :)

My first OB setup, so bear with me:

21102008183843hp8.th.jpgthpix.gif

Offline

#383 2008-10-21 22:03:01

semperfiguy
Member
Registered: 2007-12-03
Posts: 224

Re: Share your Openbox Desktop ! :)

@froli: Could you please post your .conkyrc?

Offline

#384 2008-10-22 00:55:25

froli
Member
From: Germany
Registered: 2008-06-17
Posts: 455

Re: Share your Openbox Desktop ! :)

semperfiguy wrote:

@froli: Could you please post your .conkyrc?

Okay but quotes are in french.

# Le clignotement, ça pique les yeux
double_buffer yes

# Si jamais on voulait plusieurs Conkys simultanément
own_window  yes
own_window_transparent no
own_window_type normal
own_window_hints undecorate,sticky,skip_taskbar,skip_pager

# Bordures
draw_borders no
border_margin 1

# Ombres
draw_shades no

# Position
gap_x 0
gap_y -1
alignment top_left

# Comportement
update_interval 1

# Couleurs
#default_color  696969
default_color B7B7B7
#default_shade_color 000000
#own_window_colour D1E2B4
own_window_colour 3D352A

# Polices
use_xft yes
# xftfont bauhaust:pixelsize=10
xftfont nu:pixelsize=10

# Pas bouger !
use_spacer no
minimum_size 1280 0


TEXT
${voffset -1}${alignc} ${color ECE9E2}${font}$kernel on $machine  // ${color} CPU : ${color ECE9E2}${font}${cpu}%${color}  |  ${color}Uptime : ${color ECE9E2}${font}${uptime_short}${color}  |  ${color}Root : ${color ECE9E2}${font}${fs_free /} ${color} Home : ${color ECE9E2}${font}${fs_free /home}${color}  |  WIFI: ${color ECE9E2}${wireless_link_qual_perc ath0}%${color}  |  Updates:${color ECE9E2} ${texeci 15 perl /home/froli/Documents/scripts/conky-updates.pl}${color}  |  GMail: ${color ECE9E2}${texeci 15 /home/froli/Documents/scripts/checkgmail-perso.sh}${color}  |  ${mpd_status}  -  ${color ECE9E2}${font}${mpd_smart}${color} ${mpd_bar 5,100} ${mpd_elapsed}/${mpd_length}

archlinux on Macbook Pro 10,1

Offline

#385 2008-10-22 16:21:02

tetonedge
Member
From: Fort Collins, CO
Registered: 2008-08-22
Posts: 71
Website

Re: Share your Openbox Desktop ! :)

@froli

What are you using for the weather display?

Thanks

Offline

#386 2008-10-22 16:49:49

froli
Member
From: Germany
Registered: 2008-06-17
Posts: 455

Re: Share your Openbox Desktop ! :)

tetonedge wrote:

@froli

What are you using for the weather display?

Thanks

It's conky.

.conkyrc_weather:

# Use Xft?
use_xft yes
xftfont cure:size=8

# Update interval in seconds
update_interval 1

# This is the number of times Conky will update before quitting.
# Set to zero to run forever.
total_run_times 0

# Create own window instead of using desktop (required in nautilus)
own_window  yes
own_window_transparent no
own_window_type widget
own_window_hints undecorate,sticky,skip_taskbar,skip_pager 

# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes

# Minimum size of text area
minimum_size 87 0

maximum_width 87

# Draw shades?
draw_shades no

# Draw outlines?
draw_outline no

# Draw borders around text
draw_borders yes

# Stippled borders?
stippled_borders 0

# border margins
border_margin 5

# border width
border_width 1

# Default colors and also border colors
default_color B7B7B7
#default_shade_color white
#default_outline_color black
#own_window_colour 262524
own_window_colour 3D352A

# Text alignment, other possible values are commented
#alignment top_left
#alignment top_right
#alignment bottom_left
alignment bottom_right

# Gap between borders of screen and text
# same thing as passing -x at command line
gap_x 15
gap_y 45

# Subtract file system buffers from used memory?
no_buffers yes

# set to yes if you want all text to be in uppercase
uppercase no

# number of cpu samples to average
# set to 1 to disable averaging
cpu_avg_samples 1

# number of net samples to average
# set to 1 to disable averaging
#net_avg_samples 2

# Force UTF8? note that UTF8 support required XFT
override_utf8_locale yes

# Add spaces to keep things from moving about?  This only affects certain objects.
use_spacer yes

TEXT
${color B7B7B7}${alignc}${execi 3600 python /home/froli/Documents/scripts/conkyForecast.py --location=CAXX0301 --datatype=CC}
${alignr 43}${font Weather:size=46}${execi 3600 python /home/froli/Documents/scripts/conkyForecast.py --location=CAXX0301 --datatype=WF}${font} 
${color 715F42}${voffset -32} ${execi 3600 python ~/Documents/scripts/conkyForecast.py --location=CAXX0301 --datatype=HT}


${color 715F42}Wind:${color B7B7B7}${alignr}${execi 3600 python ~/Documents/scripts/conkyForecast.py --location=CAXX0301 --datatype=WS}
${color 715F42}Direction:${color B7B7B7}${alignr 5}${execi 3600 python ~/Documents/scripts/conkyForecast.py --location=CAXX0301 --datatype=WD}
${color 715F42}Humidity:${color B7B7B7}${alignr}${execi 3600 python ~/Documents/scripts/conkyForecast.py --location=CAXX0301 --datatype=HM}
${color 715F42}Sunrise:${color B7B7B7}${alignr}${execi 3600 python ~/Documents/scripts/conkyForecast.py --location=CAXX0301 --datatype=SR}
${color 715F42}Sunset:${color B7B7B7}${alignr}${execi 3600 python ~/Documents/scripts/conkyForecast.py --location=CAXX0301 --datatype=SS}

And you'll need the conkyForecast.py script:

#!/usr/bin/python
# -*- coding: utf-8 -*-
###############################################################################
# conkyForecast.py is a (not so) simple (anymore) python script to gather 
# details of the current weather for use in conky.
#
#  Author: Kaivalagi
# Created: 13/04/2008
# Modifications:
#    14/04/2008    Allow day ranges for forecast data
#    14/04/2008    Check for connectivity to xoap service
#    18/04/2008    Allow the setting of spaces for ranged output
#    18/04/2008    Allow Night and Day forecast output
#    18/04/2008    Support locale for condition code text "CC" option, awaiting spanish language translation
#    18/04/2008    Use pickling for class data rather than opening xml, this bypasses the need to interrogate cached data
#    19/04/2008    Added spanish condition text - Thanks Bruce M
#    19/04/2008    Added isnumeric check on all numeric output with units suffix
#    19/04/2008    Altered pickle file naming to include location code
#    19/04/2008    Added spanish week days conversion via locale
#    20/04/2008    Added decent command argument parser
#    20/04/2008    Added --shortweekday option, if given the day of week data type is shortened to 3 characters
#    21/04/2008    Fixed locale options for forecast output
#    21/04/2008    Added --template option to allow custom output using a single exec call :)
#    21/04/2008    Added --hideunits option to remove, for example, mph and C from output
#    23/04/2008    Removed --imperial option from template, this MUST be set as a standard option on the script call and not used in the template file. 
#    23/04/2008    Readded --imperial option to template, enabling metric or imperial values per datatype. Note when using templates command line option will not work.
#    23/04/2008    Added output notifying user if the location given is bad
#    24/04/2008    Added handling for no connectivity, will revert to cached data now (erroring if no cache exists). Tests by trying to open xoap.weather.com
#    24/04/2008    Fixed Celsius to fahrenheit conversion
#    06/05/2008    Updated url used after webservice was updated
#    09/05/2008    Consolidated current condition and forecast data fetch into one call
#    09/05/2008    Added Sunrise and sunset to datatypes, these are specific to both current conditions and forecast data
#    09/05/2008    Added moon phase, barometer reading and barometer description to datatypes, these are only specific to current conditions and so are N/A in forecasted output
#    09/05/2008    Added unit conversions for barometer from mb to inches (imperial)
#   09/05/2008  Updated spanish condition text - Thanks Bruce M
#   10/05/2008  Added french locale data - Thanks benpaka
#   12/05/2008  Added new BF (bearing font) datatype to provide an arrow character (use with Arrow.ttf font) instead of NSEW output from WD (wind direction)
#   12/05/2008  Updated WD output to be locale specific, currently supports default english and spanish - Thanks Bruce M
#    18/05/2008    Added new MF (moon font) datatype to provide a moon font character (characters incorrect and no dedicated font yet).
#
# TODO:
# Consolidate pkl files into one file/class
# Add a weather font based moon phase output based on moon icon data
# ??? Any more requirements out there?

import sys, os, socket, urllib2, datetime, time
from xml.dom import minidom
from stat import *
from optparse import OptionParser
import locale
import gettext
import pickle
from math import *

APP="conkyForecast.py"
DIR=os.path.dirname (__file__) + '/locale'
gettext.bindtextdomain(APP, DIR)
gettext.textdomain(APP)
_ = gettext.gettext

class CommandLineParser:

    parser = None

    def __init__(self):

        self.parser = OptionParser()
        self.parser.add_option("-l","--location", dest="location", default="$LOCATION", type="string", metavar="CODE", help=u"location code for weather data [default: %default],Use the following url to determine your location code by city name: http://xoap.weather.com/search/search?where=Norwich")
        self.parser.add_option("-d","--datatype",dest="datatype", default="HT", type="string", metavar="DATATYPE", help=u"[default: %default] The data type options are: DW (Day Of Week), WF (Weather Font Output), LT (Low Temp), HT (High Temp), CC (Current Conditions), CT (Conditions Text), PC (Precipitation Chance), HM (Humidity), WD (Wind Direction), WS (Wind Speed), WG (Wind Gusts), CN (City Name), SR (sunrise), SS (sunset), MP (moon phase), MF (moon font), BR (barometer reading), BD (barometer description). Not applicable at command line when using templates.")
        self.parser.add_option("-s","--startday",dest="startday", type="int", metavar="NUMBER", help=u"define the starting day number, if omitted current conditions are output. Not applicable at command line when using templates.")
        self.parser.add_option("-e","--endday",dest="endday", type="int", metavar="NUMBER", help=u"define the ending day number, if omitted only starting day data is output. Not applicable at command line when using templates.")
        self.parser.add_option("-S","--spaces",dest="spaces", type="int", default=1, metavar="NUMBER", help=u"[default: %default] Define the number of spaces between ranged output. Not applicable at command line when using templates.")
        self.parser.add_option("-t","--template",dest="template", type="string", metavar="FILE", help=u"define a template file to generate output in one call. A displayable item in the file is in the form {--datatype=HT --startday=1}. The following are possible options within each item: --datatype,--startday,--endday,--night,--shortweekday,--imperial,--hideunits,--spaces . Note that the short forms of the options are not currently supported! None of these options are applicable at command line when using templates.")
        self.parser.add_option("-L","--locale",dest="locale", type="string", help=u"override the system locale for language output (en=english, es=spanish, fr=french, more to come)")
        self.parser.add_option("-i","--imperial",dest="imperial", default=False, action="store_true", help=u"request imperial units, if omitted output is in metric. Not applicable at command line when using templates.")
        self.parser.add_option("-n","--night",dest="night", default=False, action="store_true", help=u"switch output to night data, if omitted day output will be output. Not applicable at command line when using templates.")
        self.parser.add_option("-w","--shortweekday",dest="shortweekday", default=False, action="store_true", help=u"Shorten the day of week data type to 3 characters. Not applicable at command line when using templates.")
        self.parser.add_option("-u","--hideunits",dest="hideunits", default=False, action="store_true", help=u"Hide units such as mph or C, degree symbols (°) are still shown. Not applicable at command line when using templates.")
        self.parser.add_option("-v","--verbose",dest="verbose", default=False, action="store_true", help=u"request verbose output, no a good idea when running through conky!")
        self.parser.add_option("-r","--refetch",dest="refetch", default=False, action="store_true", help=u"fetch data regardless of data expiry")

    def parse_args(self):
        (options, args) = self.parser.parse_args()
        return (options, args)

    def print_help(self):
        return self.parser.print_help()

class WeatherData:
    def __init__(self, day_of_week, low, high, condition_code, condition_text, precip, humidity, wind_dir, wind_speed, wind_gusts, city, sunrise, sunset, moon_phase, moon_icon, bar_read, bar_desc):
        self.day_of_week = u""+day_of_week
        self.low = u""+low
        self.high = u""+high
        self.condition_code = u""+condition_code
        self.condition_text = u""+condition_text
        self.precip = u""+precip
        self.humidity = u""+humidity
        self.wind_dir = u""+wind_dir
        self.wind_speed = u""+wind_speed
        self.wind_gusts = u""+wind_gusts
        self.city = u""+city
        self.sunrise = u""+sunrise
        self.sunset = u""+sunset
        self.moon_phase = u""+moon_phase
        self.moon_icon = u""+moon_icon        
        self.bar_read = u""+bar_read
        self.bar_desc = u""+bar_desc


class WeatherText:

    conditions_text = {
        "0": _(u"Tornado"),
        "1": _(u"Tropical Storm"),
        "2": _(u"Hurricane"),
        "3": _(u"Severe Thunderstorms"),
        "4": _(u"Thunderstorms"),
        "5": _(u"Mixed Rain and Snow"),
        "6": _(u"Mixed Rain and Sleet"),
        "7": _(u"Mixed Precipitation"),
        "8": _(u"Freezing Drizzle"),
        "9": _(u"Drizzle"),
        "10": _(u"Freezing Rain"),
        "11": _(u"Showers"),
        "12": _(u"Showers"),
        "13": _(u"Snow Flurries"),
        "14": _(u"Light Snow Showers"),
        "15": _(u"Blowing Snow"),
        "16": _(u"Snow"),
        "17": _(u"Hail"),
        "18": _(u"Sleet"),
        "19": _(u"Dust"),
        "20": _(u"Fog"),
        "21": _(u"Haze"),
        "22": _(u"Smoke"),
        "23": _(u"Blustery"), 
        "24": _(u"Windy"),
        "25": _(u"Cold"),
        "26": _(u"Cloudy"),
        "27": _(u"Mostly Cloudy"),
        "28": _(u"Mostly Cloudy"),
        "29": _(u"Partly Cloudy"),
        "30": _(u"Partly Cloudy"),
        "31": _(u"Clear"),
        "32": _(u"Clear"),
        "33": _(u"Fair"),
        "34": _(u"Fair"),
        "35": _(u"Mixed Rain and Hail"),
        "36": _(u"Hot"),
        "37": _(u"Isolated Thunderstorms"),
        "38": _(u"Scattered Thunderstorms"),
        "39": _(u"Scattered Thunderstorms"),
        "40": _(u"Scattered Showers"),
        "41": _(u"Heavy Snow"),
        "42": _(u"Scattered Snow Showers"),
        "43": _(u"Heavy Snow"),
        "44": _(u"Partly Cloudy"),
        "45": _(u"Thunder Showers"),
        "46": _(u"Snow Showers"),
        "47": _(u"Isolated Thunderstorms"),
        "na": _(u"N/A"),
        "-": _(u"N/A")
    }

    conditions_text_es = {
        "0": _(u"Tornado"),
        "1": _(u"Tormenta Tropical"),
        "2": _(u"Huracá¡n"),
        "3": _(u"Tormentas Fuertes"),
        "4": _(u"Tormentas"),
        "5": _(u"Lluvia y Nieve Mezclada"),
        "6": _(u"Lluvia y Aguanieve Mezclada"),
        "7": _(u"Aguanieve"),
        "8": _(u"Llovizna Helada"),
        "9": _(u"Llovizna"),
        "10": _(u"Lluvia Engelante"), # o lluvia helada
        "11": _(u"Chaparrones"),
        "12": _(u"Chaparrones"),
        "13": _(u"Nieve Ligera"),
        "14": _(u"Nieve Ligera"),
        "15": _(u"Ventisca de Nieve"),
        "16": _(u"Nieve"),
        "17": _(u"Granizo"),
        "18": _(u"Aguanieve"),
        "19": _(u"Polvo"),
        "20": _(u"Niebla"),
        "21": _(u"Bruma"),
        "22": _(u"Humo"),
        "23": _(u"Tempestad"),
        "24": _(u"Ventoso"),
        "25": _(u"Fráo"),
        "26": _(u"Muy Nublado"),
        "27": _(u"Principalmente Nublado"),
        "28": _(u"Principalmente Nublado"),
        "29": _(u"Parcialmente Nublado"),
        "30": _(u"Parcialmente Nublado"),
        "31": _(u"Despejado"),
        "32": _(u"Despejado"),
        "33": _(u"Algo Nublado"),
        "34": _(u"Algo Nublado"),
        "35": _(u"Lluvia con Granizo"),
        "36": _(u"Calor"),
        "37": _(u"Tormentas Aisladas"),
        "38": _(u"Tormentas Dispersas"),
        "39": _(u"Tormentas Dispersas"),
        "40": _(u"Chubascos Dispersos"),
        "41": _(u"Nieve Pesada"),
        "42": _(u"Nevadas Débiles y Dispersas"),
        "43": _(u"Nevada Intensa"),
        "44": _(u"Nubes Dispersas"),
        "45": _(u"Tormentas"),
        "46": _(u"Nevadas Dispersas"),
        "47": _(u"Tormentas Aisladas"),
        "na": _(u"N/A"),
        "-": _(u"N/A")
    }

    conditions_text_fr = {
        "0": _(u"Tornade"),
        "1": _(u"Tempête Tropicale"),
        "2": _(u"Ouragan"),
        "3": _(u"Orages Violents"),
        "4": _(u"Orageux"),
        "5": _(u"Pluie et Neige"),
        "6": _(u"Pluie et Neige Mouillée"),
        "7": _(u"Variable avec averses"),
        "8": _(u"Bruine Givrante"),
        "9": _(u"Bruine"),
        "10": _(u"Pluie Glacante"),
        "11": _(u"Averses"),
        "12": _(u"Averses"),
        "13": _(u"Légère Neige"),
        "14": _(u"Forte Neige"),
        "15": _(u"Tempête de Neige"),
        "16": _(u"Neige"),
        "17": _(u"Grêle"),
        "18": _(u"Pluie/Neige"),
        "19": _(u"Nuage de poussière"),
        "20": _(u"Brouillard"),
        "21": _(u"Brume"),
        "22": _(u"Fumée"),
        "23": _(u"Tres Venteux"),
        "24": _(u"Venteux"),
        "25": _(u"Froid"),
        "26": _(u"Nuageux"),
        "27": _(u"Tres Nuageux"),
        "28": _(u"Tres Nuageux"),
        "29": _(u"Nuages Disséminés"),
        "30": _(u"Nuages Disséminés"),
        "31": _(u"Beau"),
        "32": _(u"Beau"),
        "33": _(u"Belles Éclaircies"),
        "34": _(u"Belles Éclaircies"),
        "35": _(u"Pluie avec Grêle"),
        "36": _(u"Chaleur"),
        "37": _(u"Orages Isolés"),
        "38": _(u"Orages Localisés"),
        "39": _(u"Orages Localisés"),
        "40": _(u"Averses Localisées"),
        "41": _(u"Neige Lourde"),
        "42": _(u"Tempête de Neige Localisées"),
        "43": _(u"Neige Lourde"),
        "44": _(u"Nuages Disséminés"),
        "45": _(u"Orages"),
        "46": _(u"Tempête de Neige"),
        "47": _(u"Orages Isolés"),
        "na": _(u"N/A"),
        "-": _(u"N/A")
    }
    
    conditions_weather_font = {
        "0": _(u"W"),
        "1": _(u"V"),
        "2": _(u"W"),
        "3": _(u"s"),
        "4": _(u"p"),
        "5": _(u"k"),
        "6": _(u"k"),
        "7": _(u"g"),
        "8": _(u"g"),
        "9": _(u"g"),
        "10": _(u"h"),
        "11": _(u"g"),
        "12": _(u"g"),
        "13": _(u"k"),
        "14": _(u"k"),
        "15": _(u"k"),
        "16": _(u"k"),
        "17": _(u"k"),
        "18": _(u"k"),
        "19": _(u"e"),
        "20": _(u"e"),
        "21": _(u"a"),
        "22": _(u"d"),
        "23": _(u"d"), 
        "24": _(u"d"),
        "25": _(u"d"),
        "26": _(u"e"),
        "27": _(u"e"),
        "28": _(u"e"),
        "29": _(u"c"),
        "30": _(u"c"),
        "31": _(u"a"),
        "32": _(u"a"),
        "33": _(u"b"),
        "34": _(u"b"),
        "35": _(u"k"),
        "36": _(u"a"),
        "37": _(u"f"),
        "38": _(u"f"),
        "39": _(u"f"),
        "40": _(u"g"),
        "41": _(u"k"),
        "42": _(u"k"),
        "43": _(u"k"),
        "44": _(u"b"),
        "45": _(u"g"),
        "46": _(u"k"),
        "47": _(u"f"),
        "na": _(u""),
        "-": _(u"")
    }

    conditions_moon_font = {
        "0": _(u"0"),
        "1": _(u"1"),
        "2": _(u"2"),
        "3": _(u"3"),
        "4": _(u"4"),
        "5": _(u"5"),
        "6": _(u"6"),
        "7": _(u"7"),
        "8": _(u"8"),
        "9": _(u"9"),
        "10": _(u"10"),
        "11": _(u"11"),
        "12": _(u"12"),
        "13": _(u"13"),
        "14": _(u"14"),
        "15": _(u"15"),
        "16": _(u"16"),
        "17": _(u"17"),
        "18": _(u"18"),
        "19": _(u"19"),
        "20": _(u"20"),
        "21": _(u"21"),
        "22": _(u"22"),
        "23": _(u"23"), 
        "24": _(u"24"),
        "25": _(u"25"),
        "na": _(u""),
        "-": _(u"")
    }
        
    day_of_week = {
        "Today": _(u"Today"),
        "Monday": _(u"Monday"),
        "Tuesday": _(u"Tuesday"),
        "Wednesday": _(u"Wednesday"),
        "Thursday": _(u"Thursday"),
        "Friday": _(u"Friday"),
        "Saturday": _(u"Saturday"),
        "Sunday": _(u"Sunday")
    }

    day_of_week_short = {
        "Today": _(u"Now"),
        "Monday": _(u"Mon"),
        "Tuesday": _(u"Tue"),
        "Wednesday": _(u"Wed"),
        "Thursday": _(u"Thu"),
        "Friday": _(u"Fri"),
        "Saturday": _(u"Sat"),
        "Sunday": _(u"Sun")
    }

    day_of_week_es = {
        "Today": _(u"hoy"),
        "Monday": _(u"lunes"),
        "Tuesday": _(u"martes"),
        "Wednesday": _(u"miércoles"),
        "Thursday": _(u"jueves"),
        "Friday": _(u"viernes"),
        "Saturday": _(u"sábado"),
        "Sunday": _(u"domingo")
    }

    day_of_week_short_es = {
        "Today": _(u"hoy"),
        "Monday": _(u"lun"),
        "Tuesday": _(u"mar"),
        "Wednesday": _(u"mié"),
        "Thursday": _(u"jue"),
        "Friday": _(u"vie"),
        "Saturday": _(u"sáb"),
        "Sunday": _(u"dom")
    }

    day_of_week_fr = {
        "Today": _(u"Aujourd'hui"),
        "Monday": _(u"Lundi"),
        "Tuesday": _(u"Mardi"),
        "Wednesday": _(u"Mercredi"),
        "Thursday": _(u"Jeudi"),
        "Friday": _(u"Vendredi"),
        "Saturday": _(u"Samedi"),
        "Sunday": _(u"Dimanche")
    }

    day_of_week_short_fr = {
        "Today": _(u"Auj"),
        "Monday": _(u"Lun"),
        "Tuesday": _(u"Mar"),
        "Wednesday": _(u"Mer"),
        "Thursday": _(u"Jeu"),
        "Friday": _(u"Ven"),
        "Saturday": _(u"Sam"),
        "Sunday": _(u"Dim")
    }

    bearing_arrow_font = {
        "N": _(u"a"),
        "NNE": _(u"b"),
        "NE": _(u"c"),
        "ENE": _(u"d"),
        "E": _(u"e"),
        "ESE": _(u"f"),
        "SE": _(u"g"),
        "SSE": _(u"h"),
        "S": _(u"i"),
        "SSW": _(u"j"),
        "SW": _(u"k"),
        "WSW": _(u"l"),
        "W": _(u"m"),
        "WNW": _(u"n"),
        "NW": _(u"o"),
        "NNW": _(u"p"),
        "N/A": _(u" ")
    }

    bearing_text_es = {
        "N": _(u"N"),
        "NNE": _(u"NNE"),
        "NE": _(u"NE"),
        "ENE": _(u"ENE"),
        "E": _(u"E"),
        "ESE": _(u"ESE"),
        "SE": _(u"SE"),
        "SSE": _(u"SSE"),
        "S": _(u"S"),
        "SSW": _(u"SSO"),
        "SW": _(u"SO"),
        "WSW": _(u"WOW"),
        "W": _(u"O"),
        "WNW": _(u"ONO"),
        "NW": _(u"NO"),
        "NNW": _(u"NNO"),
        "N/A": _(u"N\A")
    }

    bearing_text_fr = {
        "N": _(u"N"),
        "NNE": _(u"NNE"),
        "NE": _(u"NE"),
        "ENE": _(u"ENE"),
        "E": _(u"E"),
        "ESE": _(u"ESE"),
        "SE": _(u"SE"),
        "SSE": _(u"SSE"),
        "S": _(u"S"),
        "SSW": _(u"SSO"),
        "SW": _(u"SO"),
        "WSW": _(u"WOW"),
        "W": _(u"O"),
        "WNW": _(u"ONO"),
        "NW": _(u"NO"),
        "NNW": _(u"NNO"),
        "N/A": _(u"N\A")        
    }
              
class GlobalWeather:

    current_conditions = []
    day_forecast = []
    night_forecast = []

    locale = "fr"

    options = None
    weatherxmldoc = ""

     TEMP_FILEPATH_CURRENT = "/tmp/conkyForecast-c-LOCATION.pkl"
    TEMP_FILEPATH_DAYFORECAST = "/tmp/conkyForecast-df-LOCATION.pkl"
    TEMP_FILEPATH_NIGHTFORECAST = "/tmp/conkyForecast-nf-LOCATION.pkl"
     EXPIRY_MINUTES = 30
    DEFAULT_SPACING = u" "
        

    def __init__(self,options):

        self.options = options
        
        if self.options.locale == None:
            try:
                self.locale = locale.getdefaultlocale()[0][0:2]
                #self.locale = "es" #uncomment this line to force Spanish locale
                #self.locale = "fr" #uncomment this line to force French locale                
            except:
                print "locale not set"
        else:
            self.locale = self.options.locale
            #self.locale = "es" #uncomment this line to force Spanish locale
            #self.locale = "fr" #uncomment this line to force French locale    

        if self.options.verbose == True:
            print >> sys.stdout, "locale set to ",self.locale

    def getText(self,nodelist):
        rc = ""
        for node in nodelist:
            if node.nodeType == node.TEXT_NODE:
                rc = rc + node.data
        return rc


    def getSpaces(self,spaces):
        string = u""
        if spaces == None:
            string = self.DEFAULT_SPACING
        else:
            for i in range(0, spaces+1):
                string = string + u" "
        return string


    def isNumeric(self,string):
        try:
            dummy = float(string)
            return True
        except:
            return False

    def isConnectionAvailable(self):
        # ensure we can access weather.com's server by opening the url
        try:
            usock = urllib2.urlopen('http://xoap.weather.com')
            usock.close()
            return True
        except:
            return False

    def getBearingText(self,bearing):
        bearing = float(bearing)
        if bearing < 11.25:
            return u"N"
        elif bearing < 33.75:
            return u"NNE"
        elif bearing < 56.25:
            return u"NE"
        elif bearing < 78.75:
            return u"ENE"
        elif bearing < 101.25:
            return u"E"
        elif bearing < 123.75:
            return u"ESE"
        elif bearing < 146.25:
            return u"SE"
        elif bearing < 168.75:
            return u"SSE"
        elif bearing < 191.25:
            return u"S"
        elif bearing < 213.75:
            return u"SSW"
        elif bearing < 236.25:
            return u"SW"
        elif bearing < 258.75:
            return u"WSW"
        elif bearing < 281.25:
            return u"W"
        elif bearing < 303.75:
            return u"WNW"
        elif bearing < 326.25:
            return u"NW"
        elif bearing < 348.75:
            return u"NNW"
        else:
            return "N/A"

    def convertCelsiusToFahrenheit(self,temp):
        return str(int(floor(((float(temp)*9.0)/5.0)+32)))

    def convertKilometresToMiles(self,dist):
        return str(int(floor(float(dist)*0.621371192)))

    def convertMillibarsToInches(self,mb):
        return str(int(floor(float(mb)/33.8582)))

    def getTemplateList(self,template):

        templatelist = []
    
        for template_part in template.split("{"):
            if template_part != "":
                for template_part in template_part.split("}"):
                    if template_part != "":
                        templatelist.append(u""+template_part)

        return templatelist


    def getOutputText(self,datatype,startday,endday,night,shortweekday,imperial,hideunits,spaces):
        #try:
            output = u""
        
            # define current units for output
            if hideunits == False:
                if imperial == False:
                    tempunit = u"°C"
                    speedunit = u"kph"
                    pressureunit = u"mb"
                else:
                    tempunit = u"°F"
                    speedunit = u"mph"
                    pressureunit = u"in"
            else:
                tempunit = u"°"
                speedunit = u""
                pressureunit = u""

            if startday == None: # current conditions

                if datatype == "DW":
                    if self.locale == "es":
                        if shortweekday == True:
                            output = WeatherText.day_of_week_short_es[self.current_conditions[0].day_of_week]
                        else:
                            output = WeatherText.day_of_week_es[self.current_conditions[0].day_of_week]
                    elif self.locale == "fr":
                        if shortweekday == True:
                            output = WeatherText.day_of_week_short_fr[self.current_conditions[0].day_of_week]
                        else:
                            output = WeatherText.day_of_week_fr[self.current_conditions[0].day_of_week]                
                    else:
                        if shortweekday == True:
                            output = WeatherText.day_of_week_short[self.current_conditions[0].day_of_week]
                        else:
                            output = WeatherText.day_of_week[self.current_conditions[0].day_of_week]
                elif datatype == "WF": # weather font
                    output = WeatherText.conditions_weather_font[self.current_conditions[0].condition_code]
                elif datatype == "LT":
                    string = self.current_conditions[0].low
                    if self.isNumeric(string) == True:
                        if imperial == True:
                            string = self.convertCelsiusToFahrenheit(string)
                        string = string + tempunit
                    output = string
                elif datatype == "HT":
                    string = self.current_conditions[0].high
                    if self.isNumeric(string) == True:
                        if imperial == True:
                            string = self.convertCelsiusToFahrenheit(string)
                        string = string + tempunit
                    output = string
                elif datatype == "CC":
                    if self.locale == "es":
                        output = WeatherText.conditions_text_es[self.current_conditions[0].condition_code]
                    elif self.locale == "fr":
                        output = WeatherText.conditions_text_fr[self.current_conditions[0].condition_code]                
                    else:
                        output = WeatherText.conditions_text[self.current_conditions[0].condition_code] 
                elif datatype == "CT":
                    output = self.current_conditions[0].condition_text
                elif datatype == "PC":
                    string = self.current_conditions[0].precip
                    if self.isNumeric(string) == True:
                        string = string + u"%"
                    output = string
                elif datatype == "HM":
                    string = self.current_conditions[0].humidity
                    if self.isNumeric(string) == True:
                        string = string + u"%"
                    output = string
                elif datatype == "WD":
                    string = self.current_conditions[0].wind_dir
                    if self.isNumeric(string) == True:
                        string = self.getBearingText(string)
                        
                    if self.locale == "es":
                        output = WeatherText.bearing_text_es[string]
                    elif self.locale == "fr":
                        output = WeatherText.bearing_text_fr[string]
                    else:
                        output = string
                                        
                elif datatype == "BF":
                    string = self.current_conditions[0].wind_dir
                    if self.isNumeric(string) == True:
                        string = WeatherText.bearing_arrow_font[self.getBearingText(string)]
                    output = string                
                elif datatype == "WS":
                    string = self.current_conditions[0].wind_speed
                    if self.isNumeric(string) == True:
                        if imperial == True:
                            string = self.convertKilometresToMiles(string)
                        string = string + speedunit
                    output = string
                elif datatype == "WG":
                    string = self.current_conditions[0].wind_gusts
                    if self.isNumeric(string) == True:
                        if imperial == True:
                            string = self.convertKilometresToMiles(string)
                        string = string + speedunit
                    output = string
                elif datatype == "CN":
                    output = self.current_conditions[0].city
                elif datatype == "SR":
                    output = self.current_conditions[0].sunrise
                elif datatype == "SS":
                    output = self.current_conditions[0].sunset
                elif datatype == "MP":
                    output = self.current_conditions[0].moon_phase
                elif datatype == "MF":
                    output = WeatherText.conditions_moon_font[self.current_conditions[0].moon_icon]                        
                elif datatype == "BR":
                    string = self.current_conditions[0].bar_read
                    if self.isNumeric(string) == True:
                        if imperial == True:
                            string = self.convertMillibarsToInches(string)
                        string = string + pressureunit
                    output = string
                elif datatype == "BD":
                    output = self.current_conditions[0].bar_desc
                else:
                    output = "\nERROR:Unknown data type requested"

            else: # forecast data

                if endday == None: # if no endday was set use startday
                    endday = startday

                if night == True: # night forecast required

                    for day_number in range(startday, endday+1):

                        if datatype == "DW":
                            if self.locale == "es":
                                if shortweekday == True:
                                    output = output + self.getSpaces(spaces) + WeatherText.day_of_week_short_es[self.night_forecast[day_number].day_of_week]
                                else:
                                    output = output + self.getSpaces(spaces) + WeatherText.day_of_week_es[self.night_forecast[day_number].day_of_week]
                            elif self.locale == "fr":
                                if shortweekday == True:
                                    output = output + self.getSpaces(spaces) + WeatherText.day_of_week_short_fr[self.night_forecast[day_number].day_of_week]
                                else:
                                    output = output + self.getSpaces(spaces) + WeatherText.day_of_week_fr[self.night_forecast[day_number].day_of_week]
                            else:
                                if shortweekday == True:
                                    output = output + self.getSpaces(spaces) + WeatherText.day_of_week_short[self.night_forecast[day_number].day_of_week]
                                else:
                                    output = output + self.getSpaces(spaces) + WeatherText.day_of_week[self.night_forecast[day_number].day_of_week]
                        elif datatype == "WF": # weather font
                            output = output + self.getSpaces(spaces) + WeatherText.conditions_weather_font[self.night_forecast[day_number].condition_code]
                        elif datatype == "LT":
                            string = self.night_forecast[day_number].low
                            if self.isNumeric(string) == True:
                                if imperial == True:
                                    string = self.convertCelsiusToFahrenheit(string)
                                string = string + tempunit
                            output = output + self.getSpaces(spaces) + string

                        elif datatype == "HT":
                            string = self.night_forecast[day_number].high
                            if self.isNumeric(string) == True:
                                if imperial == True:
                                    string = self.convertCelsiusToFahrenheit(string)
                                string = string + tempunit
                            output = output + self.getSpaces(spaces) + string
                        elif datatype == "CC":
                            if self.locale == "es":
                                output = output + self.getSpaces(spaces) + WeatherText.conditions_text_es[self.night_forecast[day_number].condition_code]
                            elif self.locale == "fr":
                                output = output + self.getSpaces(spaces) + WeatherText.conditions_text_fr[self.night_forecast[day_number].condition_code]
                            else:
                                output = output + self.getSpaces(spaces) + WeatherText.conditions_text[self.night_forecast[day_number].condition_code]
                        elif datatype == "CT":
                            output = output + self.getSpaces(spaces) + self.night_forecast[day_number].condition_text
                        elif datatype == "PC":
                            string = self.night_forecast[day_number].precip
                            if self.isNumeric(string) == True:
                                string = string + u"%"
                            output = output + self.getSpaces(spaces) + string
                        elif datatype == "HM":
                            string = self.night_forecast[day_number].humidity
                            if self.isNumeric(string) == True:
                                string = string + u"%"
                            output = output + self.getSpaces(spaces) + string
                        elif datatype == "WD":
                            string = self.night_forecast[day_number].wind_dir
                            if self.locale == "es":
                                output = output + self.getSpaces(spaces) + WeatherText.bearing_text_es[string]
                            elif self.locale == "fr":
                                output = output + self.getSpaces(spaces) + WeatherText.bearing_text_fr[string]
                            else:
                                output = output + self.getSpaces(spaces) + string
                            
                        elif datatype == "BF":
                            output = output + self.getSpaces(spaces) + WeatherText.bearing_arrow_font[self.night_forecast[day_number].wind_dir]
                        elif datatype == "WS":
                            string = self.night_forecast[day_number].wind_speed
                            if self.isNumeric(string) == True:
                                if imperial == True:
                                    string = self.convertKilometresToMiles(string)
                                string = string + speedunit
                            output = output + self.getSpaces(spaces) + string
                        elif datatype == "WG":
                            string = self.night_forecast[day_number].wind_gusts
                            if self.isNumeric(string) == True:
                                if imperial == True:
                                    string = self.convertKilometresToMiles(string)
                                string = string + speedunit
                            output = output + self.getSpaces(spaces) + string
                        elif datatype == "CN":
                            output = output + self.getSpaces(spaces) + self.night_forecast[day_number].city
                        elif datatype == "SR":
                            output = output + self.getSpaces(spaces) + self.night_forecast[day_number].sunrise
                        elif datatype == "SS":
                            output = output + self.getSpaces(spaces) + self.night_forecast[day_number].sunset
                        elif datatype == "MP":
                            output = output + self.getSpaces(spaces) + self.night_forecast[day_number].moon_phase
                        elif datatype == "MF":
                            output = output + self.getSpaces(spaces) + WeatherText.conditions_moon_font[self.night_forecast[day_number].moon_icon]
                        elif datatype == "BR":
                            output = output + self.getSpaces(spaces) + self.night_forecast[day_number].bar_read
                        elif datatype == "BD":
                            output = output + self.getSpaces(spaces) + self.night_forecast[day_number].bar_desc
                        else:
                            output = "\nERROR:Unknown data type requested"
                            break

                else: # day forecast wanted

                    for day_number in range(startday, endday+1):

                        if datatype == "DW":
                            if self.locale == "es":
                                if shortweekday == True:
                                    output = output + self.getSpaces(spaces) + WeatherText.day_of_week_short_es[self.day_forecast[day_number].day_of_week]
                                else:
                                    output = output + self.getSpaces(spaces) + WeatherText.day_of_week_es[self.day_forecast[day_number].day_of_week]
                            elif self.locale == "fr":
                                if shortweekday == True:
                                    output = output + self.getSpaces(spaces) + WeatherText.day_of_week_short_fr[self.day_forecast[day_number].day_of_week]
                                else:
                                    output = output + self.getSpaces(spaces) + WeatherText.day_of_week_fr[self.day_forecast[day_number].day_of_week]                            
                            else:
                                if shortweekday == True:
                                    output = output + self.getSpaces(spaces) + WeatherText.day_of_week_short[self.day_forecast[day_number].day_of_week]
                                else:
                                    output = output + self.getSpaces(spaces) + WeatherText.day_of_week[self.day_forecast[day_number].day_of_week]
                        elif datatype == "WF": # weather font
                            output = output + self.getSpaces(spaces) + WeatherText.conditions_weather_font[self.day_forecast[day_number].condition_code]
                        elif datatype == "LT":
                            string = self.day_forecast[day_number].low
                            if self.isNumeric(string) == True:
                                if imperial == True:
                                    string = self.convertCelsiusToFahrenheit(string)
                                string = string + tempunit
                            output = output + self.getSpaces(spaces) + string
                        elif datatype == "HT":
                            string = self.day_forecast[day_number].high
                            if self.isNumeric(string) == True:
                                if imperial == True:
                                    string = self.convertCelsiusToFahrenheit(string)
                                string = string + tempunit
                            output = output + self.getSpaces(spaces) + string
                        elif datatype == "CC":
                            if self.locale == "es":
                                output = output + self.getSpaces(spaces) + WeatherText.conditions_text_es[self.day_forecast[day_number].condition_code]
                            elif self.locale == "fr":
                                output = output + self.getSpaces(spaces) + WeatherText.conditions_text_fr[self.day_forecast[day_number].condition_code]
                            else:
                                output = output + self.getSpaces(spaces) + WeatherText.conditions_text[self.day_forecast[day_number].condition_code]
                        elif datatype == "CT":
                            output = output + self.getSpaces(spaces) + self.day_forecast[day_number].condition_text
                        elif datatype == "PC":
                            string = self.day_forecast[day_number].precip
                            if self.isNumeric(string) == True:
                                string = string + u"%"
                            output = output + self.getSpaces(spaces) + string
                        elif datatype == "HM":
                            string = self.day_forecast[day_number].humidity
                            if self.isNumeric(string) == True:
                                string = string + u"%"
                            output = output + self.getSpaces(spaces) + string
                        elif datatype == "WD":
                            string = self.day_forecast[day_number].wind_dir
                            
                            if self.locale == "es":
                                output = output + self.getSpaces(spaces) + WeatherText.bearing_text_es[string]
                            elif self.locale == "fr":
                                output = output + self.getSpaces(spaces) + WeatherText.bearing_text_fr[string]
                            else:
                                output = output + self.getSpaces(spaces) + string    

                        elif datatype == "BF":
                            output = output + self.getSpaces(spaces) + WeatherText.bearing_arrow_font[self.day_forecast[day_number].wind_dir]
                        elif datatype == "WS":
                            string = self.day_forecast[day_number].wind_speed
                            if self.isNumeric(string) == True:
                                if imperial == True:
                                    string = self.convertKilometresToMiles(string)
                                string = string + speedunit
                            output = output + self.getSpaces(spaces) + string
                        elif datatype == "WG":
                            string = self.day_forecast[day_number].wind_gusts
                            if self.isNumeric(string) == True:
                                if imperial == True:
                                    string = self.convertKilometresToMiles(string)
                                string = string + speedunit
                            output = output + self.getSpaces(spaces) + string
                        elif datatype == "CN":
                            output = output + self.getSpaces(spaces) + self.day_forecast[day_number].city
                        elif datatype == "SR":
                            output = output + self.getSpaces(spaces) + self.day_forecast[day_number].sunrise
                        elif datatype == "SS":
                            output = output + self.getSpaces(spaces) + self.day_forecast[day_number].sunset
                        elif datatype == "MP":
                            output = output + self.getSpaces(spaces) + self.day_forecast[day_number].moon_phase
                        elif datatype == "MF":
                            output = output + self.getSpaces(spaces) + WeatherText.conditions_moon_font[self.day_forecast[day_number].moon_icon]
                        elif datatype == "BR":
                            output = output + self.getSpaces(spaces) + self.day_forecast[day_number].bar_read
                        elif datatype == "BD":
                            output = output + self.getSpaces(spaces) + self.day_forecast[day_number].bar_desc
                        else:
                            output = u"\nERROR:Unknown data type requested"
                            break

            output = u""+output.strip(u" ") # lose leading/trailing spaces
            return output

        #except:
            #print "getOutputText:Unexpected error: ", sys.exc_info()[0]


    def getOutputTextFromTemplate(self,template):
        #try:

            # keys to template data
            DATATYPE_KEY = "--datatype="
            STARTDAY_KEY = "--startday="
            ENDDAY_KEY = "--endday="
            NIGHT_KEY = "--night"
            SHORTWEEKDAY_KEY = "--shortweekday"
            IMPERIAL_KEY = "--imperial"
            HIDEUNITS_KEY = "--hideunits"
            SPACES_KEY = "--spaces="

            output = u""

            optionfound = False

            #load the file
            try:
                fileinput = open(self.options.template)
                template = fileinput.read()
                fileinput.close()
            except:
                output = u"Template file no found!"

            templatelist = self.getTemplateList(template)

            # lets walk through the template list and determine the output for each item found
            for i in range(0,len(templatelist)-1):

                pos = templatelist[i].find(DATATYPE_KEY)
                if pos != -1:
                    optionfound = True
                    pos = pos + len(DATATYPE_KEY)
                    datatype = templatelist[i][pos:pos+4].strip("}").strip("{").strip("-").strip(" ")
                else:
                    datatype = None

                pos = templatelist[i].find(STARTDAY_KEY)
                if pos != -1:
                    optionfound = True
                    pos = pos + len(STARTDAY_KEY)
                    startday = int(templatelist[i][pos:pos+4].strip("}").strip("{").strip("-").strip(" "))
                else:
                    startday = None

                pos = templatelist[i].find(ENDDAY_KEY)
                if pos != -1:
                    optionfound = True
                    pos = pos + len(ENDDAY_KEY)
                    endday = int(templatelist[i][pos:pos+4].strip("}").strip("{").strip("-").strip(" "))
                else:
                    endday = None

                pos = templatelist[i].find(NIGHT_KEY)
                if pos != -1:
                    optionfound = True
                    night = True
                else:
                    night = False

                pos = templatelist[i].find(SHORTWEEKDAY_KEY)
                if pos != -1:
                    optionfound = True
                    shortweekday = True
                else:
                    shortweekday = False

                pos = templatelist[i].find(IMPERIAL_KEY)
                if pos != -1:
                    optionfound = True
                    imperial = True
                else:
                    imperial = False

                pos = templatelist[i].find(HIDEUNITS_KEY)
                if pos != -1:
                    optionfound = True
                    hideunits = True
                else:
                    hideunits = False

                pos = templatelist[i].find(SPACES_KEY)
                if pos != -1:
                    optionfound = True
                    pos = pos + len(SPACES_KEY)
                    spaces = int(templatelist[i][pos:pos+4].strip("}").strip("{").strip("-").strip(" "))
                else:
                    spaces = 1

                if optionfound == True:
                    templatelist[i] = self.getOutputText(datatype,startday,endday,night,shortweekday,imperial,hideunits,spaces)
                    optionfound = False

            # go through the list concatenating the output now that it's been populated
            for item in templatelist:
                output = output + item

            return output

        #except:
            #print "getOutputTextFromTemplate:Unexpected error: ", sys.exc_info()[0]


    def fetchData(self):

        # always fetch metric data, use conversation functions on this data
        file_path_current = self.TEMP_FILEPATH_CURRENT.replace("LOCATION",self.options.location)
        file_path_dayforecast = self.TEMP_FILEPATH_DAYFORECAST.replace("LOCATION",self.options.location)
        file_path_nightforecast = self.TEMP_FILEPATH_NIGHTFORECAST.replace("LOCATION",self.options.location)

        if self.isConnectionAvailable() == False:
            if os.path.exists(file_path_current):
                RefetchData = False
            else: # no connection, no cache, bang!
                print "No internet connection is available and no cached weather data exists."
        elif self.options.refetch == True:
            RefetchData = True
        else:
             # does the data need retrieving again?
             if os.path.exists(file_path_current):
                 lastmodDate = time.localtime(os.stat(file_path_current)[ST_MTIME])
                expiryDate = (datetime.datetime.today() - datetime.timedelta(minutes=self.EXPIRY_MINUTES)).timetuple()

                if expiryDate > lastmodDate:
                    RefetchData = True
                else:
                    RefetchData = False
            else:
                RefetchData = True


                # fetch the current conditions data, either from the website or by 'unpickling'
         if RefetchData == True:

            # obtain current conditions data from xoap service
            try:

                # http://xoap.weather.com/weather/local/UKXX0103?cc=*&dayf=5&link=xoap&prod=xoap&par=1061785028&key=e374effbfd74930b

                url = 'http://xoap.weather.com/weather/local/' + self.options.location + '?cc=*&dayf=8&link=xoap&prod=xoap&par=1061785028&key=e374effbfd74930b&unit=m'
                if self.options.verbose == True:
                    print >> sys.stdout, "fetching weather data from ",url

                usock = urllib2.urlopen(url)
                xml = usock.read()
                usock.close()
                self.weatherxmldoc = minidom.parseString(xml)
            except:
                print "fetchData:Unexpected error: ", sys.exc_info()[0]
                print "Unable to contact weather source for current conditions"

            # tell the user if the location is bad...
            found = xml.find("Invalid location provided")
            if found != -1:
                print "Invalid location provided"

            # interrogate weather data, load into class structure and pickle it
            try:

                # prepare weather data lists
                self.current_conditions = []
                self.day_forecast = []
                self.night_forecast = []

                # collect general data
                weather_n = self.weatherxmldoc.documentElement
                location_n = weather_n.getElementsByTagName('loc')[0]
                city_n = location_n.getElementsByTagName('dnam')[0]
                city = self.getText(city_n.childNodes)

                # collect current conditions data
                day_of_week = u"Today"
                precip = u"N/A"
                sunrise_n = location_n.getElementsByTagName('sunr')[0]
                sunrise = self.getText(sunrise_n.childNodes)
                sunset_n = location_n.getElementsByTagName('suns')[0]
                sunset = self.getText(sunset_n.childNodes)
                current_condition_n = weather_n.getElementsByTagName('cc')[0]
                current_desc_n = current_condition_n.getElementsByTagName('t')[0]
                current_desc = self.getText(current_desc_n.childNodes)
                current_code_n = current_condition_n.getElementsByTagName('icon')[0]
                current_code = self.getText(current_code_n.childNodes)
                current_temp_n = current_condition_n.getElementsByTagName('tmp')[0]
                current_temp = self.getText(current_temp_n.childNodes)
                current_temp_feels_n = current_condition_n.getElementsByTagName('flik')[0]
                current_temp_feels = self.getText(current_temp_feels_n.childNodes)
                bar_n = current_condition_n.getElementsByTagName('bar')[0]
                bar_read_n = bar_n.getElementsByTagName('r')[0]
                bar_read = self.getText(bar_read_n.childNodes)
                bar_desc_n = bar_n.getElementsByTagName('d')[0]
                bar_desc = self.getText(bar_desc_n.childNodes)
                wind_n = current_condition_n.getElementsByTagName('wind')[0]
                wind_speed_n = wind_n.getElementsByTagName('s')[0]
                wind_speed = self.getText(wind_speed_n.childNodes)
                wind_gust_n = wind_n.getElementsByTagName('gust')[0]
                wind_gusts = self.getText(wind_gust_n.childNodes)
                wind_dir_n = wind_n.getElementsByTagName('d')[0]
                wind_direction = self.getText(wind_dir_n.childNodes)
                humidity_n = current_condition_n.getElementsByTagName('hmid')[0]
                humidity = self.getText(humidity_n.childNodes)
                moon_n = current_condition_n.getElementsByTagName('moon')[0]
                moon_icon_n = moon_n.getElementsByTagName('icon')[0]
                moon_icon = self.getText(moon_icon_n.childNodes)
                moon_phase_n = moon_n.getElementsByTagName('t')[0]
                moon_phase = self.getText(moon_phase_n.childNodes)
                current_conditions_data = WeatherData(day_of_week, current_temp, current_temp, current_code, current_desc, precip, humidity, wind_direction, wind_speed, wind_gusts, city, sunrise, sunset, moon_phase, moon_icon, bar_read, bar_desc)
                self.current_conditions.append(current_conditions_data)

                # collect forecast data
                bar_read = u"N/A"
                bar_desc = u"N/A"
                moon_phase = u"N/A"
                moon_icon = u"na"
                forecast_n = weather_n.getElementsByTagName('dayf')[0]
                day_nodes = forecast_n.getElementsByTagName('day')
    
                for day in day_nodes:
                    day_of_week = day.getAttribute('t')
                    day_of_year = day.getAttribute('dt')
                    high_temp_n = day.getElementsByTagName('hi')[0]
                    high_temp = self.getText(high_temp_n.childNodes)
                    low_temp_n = day.getElementsByTagName('low')[0]
                    low_temp = self.getText(low_temp_n.childNodes)

                    sunrise_n = day.getElementsByTagName('sunr')[0]
                    sunrise = self.getText(sunrise_n.childNodes)
                    sunset_n = day.getElementsByTagName('suns')[0]
                    sunset = self.getText(sunset_n.childNodes)

                    # day forecast specific data
                    daytime_n = day.getElementsByTagName('part')[0] # day
                    condition_code_n = daytime_n.getElementsByTagName('icon')[0]
                    condition_code = self.getText(condition_code_n.childNodes)
                    condition_n = daytime_n.getElementsByTagName('t')[0]
                    condition = self.getText(condition_n.childNodes)
                    precip_n = daytime_n.getElementsByTagName('ppcp')[0]
                    precip = self.getText(precip_n.childNodes)
                    humidity_n = daytime_n.getElementsByTagName('hmid')[0]
                    humidity = self.getText(humidity_n.childNodes)
                    wind_n = daytime_n.getElementsByTagName('wind')[0]
                    wind_speed_n = wind_n.getElementsByTagName('s')[0]
                    wind_speed = self.getText(wind_speed_n.childNodes)
                    wind_direction_n = wind_n.getElementsByTagName('t')[0]
                    wind_direction = self.getText(wind_direction_n.childNodes)
                    wind_gusts_n = wind_n.getElementsByTagName('gust')[0]
                    wind_gusts = self.getText(wind_gusts_n.childNodes)
                    day_forecast_data = WeatherData(day_of_week, low_temp, high_temp, condition_code, condition, precip, humidity, wind_direction, wind_speed, wind_gusts, city, sunrise, sunset, moon_phase, moon_icon, bar_read, bar_desc)
                    self.day_forecast.append(day_forecast_data)     

                    # night forecast specific data
                    daytime_n = day.getElementsByTagName('part')[1] # night
                    condition_code_n = daytime_n.getElementsByTagName('icon')[0]
                    condition_code = self.getText(condition_code_n.childNodes)
                    condition_n = daytime_n.getElementsByTagName('t')[0]
                    condition = self.getText(condition_n.childNodes)
                    precip_n = daytime_n.getElementsByTagName('ppcp')[0]
                    precip = self.getText(precip_n.childNodes)
                    humidity_n = daytime_n.getElementsByTagName('hmid')[0]
                    humidity = self.getText(humidity_n.childNodes)
                    wind_n = daytime_n.getElementsByTagName('wind')[0]
                    wind_speed_n = wind_n.getElementsByTagName('s')[0]
                    wind_speed = self.getText(wind_speed_n.childNodes)
                    wind_direction_n = wind_n.getElementsByTagName('t')[0]
                    wind_direction = self.getText(wind_direction_n.childNodes)
                    wind_gusts_n = wind_n.getElementsByTagName('gust')[0]
                    wind_gusts = self.getText(wind_gusts_n.childNodes)
                    night_forecast_data = WeatherData(day_of_week, low_temp, high_temp, condition_code, condition, precip, humidity, wind_direction, wind_speed, wind_gusts, city, sunrise, sunset, moon_phase, moon_icon, bar_read, bar_desc)
                    self.night_forecast.append(night_forecast_data) 


                # pickle the data for next time!
                fileoutput = open(file_path_current, 'w')
                 pickle.dump(self.current_conditions,fileoutput)
                 fileoutput.close()

                fileoutput = open(file_path_dayforecast, 'w')
                 pickle.dump(self.day_forecast,fileoutput)
                 fileoutput.close()

                fileoutput = open(file_path_nightforecast, 'w')
                 pickle.dump(self.night_forecast,fileoutput)
                 fileoutput.close()
        
            except:
                print "fetchData:Unexpected error: ", sys.exc_info()[0]
                print "Unable to interrogate the weather data"

        else: # fetch weather data from pickled class files
            if self.options.verbose == True:
                print >> sys.stdout, "fetching weather data from file: ",file_path_current

             fileinput = open(file_path_current, 'r')
            self.current_conditions = pickle.load(fileinput)
            fileinput.close()

            if self.options.verbose == True:
                print >> sys.stdout, "fetching day forecast data from files: ",file_path_dayforecast, file_path_nightforecast

             fileinput = open(file_path_dayforecast, 'r')
            self.day_forecast = pickle.load(fileinput)
            fileinput.close()

            if self.options.verbose == True:
                print >> sys.stdout, "fetching day forecast data from files: ",file_path_nightforecast, file_path_nightforecast

             fileinput = open(file_path_nightforecast, 'r')
            self.night_forecast = pickle.load(fileinput)
            fileinput.close()

    def outputData(self):
        #try:

            if self.options.template != None:

                output = self.getOutputTextFromTemplate(self.options.template)

            else:

                output = self.getOutputText(self.options.datatype,self.options.startday,self.options.endday,self.options.night,self.options.shortweekday,self.options.imperial,self.options.hideunits,self.options.spaces)


            print output.encode("utf-8")

        #except:
            #print "outputData:Unexpected error: ", sys.exc_info()[0]

if __name__ == "__main__":

    parser = CommandLineParser()
    (options, args) = parser.parse_args()

    if options.verbose == True:
        print >> sys.stdout, "location:",options.location
        print >> sys.stdout, "imperial:",options.imperial
        print >> sys.stdout, "datatype:",options.datatype
        print >> sys.stdout, "night:",options.night
        print >> sys.stdout, "start day:",options.startday
        print >> sys.stdout, "end day:",options.endday
        print >> sys.stdout, "spaces:",options.spaces
        print >> sys.stdout, "verbose:",options.verbose
        print >> sys.stdout, "refetch:",options.refetch

    # create new global weather object
    weather = GlobalWeather(options)
    weather.fetchData()
    weather.outputData()%

archlinux on Macbook Pro 10,1

Offline

#387 2008-10-22 17:43:30

Daisuke_Aramaki
Member
From: ++49/711
Registered: 2008-10-06
Posts: 651
Website

Re: Share your Openbox Desktop ! :)

Just for a change, using a lil bit of openbox!

2008-10-22-194353_1680x1050_scrot498.png.xs.jpg


"You know what I found? Right in the kernel, in the heart of the operating system, I found a developer's comment that said, `Does this belong here?`" -- Simon Lok about Linux kernel in 2005
Reflections on the Strange and the not so Strange
http://skinwalker.wordpress.com

Offline

#388 2008-10-22 17:50:02

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819
Website

Re: Share your Openbox Desktop ! :)

froli wrote:
tetonedge wrote:

@froli

What are you using for the weather display?

Thanks

It's conky.

I was interested in that too, thanks smile. And congrats with the nice desktop Froli smile.

Do you have a link to the Weather font too?

Merci beaucoup wink

Last edited by B (2008-10-22 17:51:08)


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

#389 2008-10-22 17:54:40

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,965
Website

Re: Share your Openbox Desktop ! :)

Daisuke_Aramaki wrote:

Just for a change, using a lil bit of openbox!

http://xs432.xs.to/xs432/08433/2008-10- … png.xs.jpg

What program is that showing the graphs/networks?
EDIT
Make that "what program produced that image?".

Last edited by Xyne (2008-10-22 18:04:24)


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#390 2008-10-22 17:59:33

Daisuke_Aramaki
Member
From: ++49/711
Registered: 2008-10-06
Posts: 651
Website

Re: Share your Openbox Desktop ! :)

Xyne wrote:
Daisuke_Aramaki wrote:

Just for a change, using a lil bit of openbox!

http://xs432.xs.to/xs432/08433/2008-10- … png.xs.jpg

What program is that showing the graphs/networks?

that's a picture of one of my simulated boolean networks, part of my work. i used the program Discrete Dynamics Lab, and runs on a console!


"You know what I found? Right in the kernel, in the heart of the operating system, I found a developer's comment that said, `Does this belong here?`" -- Simon Lok about Linux kernel in 2005
Reflections on the Strange and the not so Strange
http://skinwalker.wordpress.com

Offline

#391 2008-10-22 18:05:30

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,965
Website

Re: Share your Openbox Desktop ! :)

Daisuke_Aramaki wrote:

that's a picture of one of my simulated boolean networks, part of my work. i used the program Discrete Dynamics Lab, and runs on a console!

Thanks. I saw your reply just after editing my post. smile

EDIT
Is there a pkg/PKGBUILD available for that, or did you download it directly from the site?

Last edited by Xyne (2008-10-22 18:07:35)


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#392 2008-10-22 21:01:01

froli
Member
From: Germany
Registered: 2008-06-17
Posts: 455

Re: Share your Openbox Desktop ! :)

B wrote:
froli wrote:
tetonedge wrote:

@froli

What are you using for the weather display?

Thanks

It's conky.

I was interested in that too, thanks smile. And congrats with the nice desktop Froli smile.

Do you have a link to the Weather font too?

Merci beaucoup wink

Thanks dude!

I forgot where I found it so I uploaded it on my skydrive(I know, it's bad to use microsoft products sad)

You can download here

and... lol ... where are you from?

Last edited by froli (2008-10-22 21:03:31)


archlinux on Macbook Pro 10,1

Offline

#393 2008-10-22 21:01:43

froli
Member
From: Germany
Registered: 2008-06-17
Posts: 455

Re: Share your Openbox Desktop ! :)

posted two times...

Last edited by froli (2008-10-22 21:02:51)


archlinux on Macbook Pro 10,1

Offline

#394 2008-10-22 22:19:21

Rydgel
Member
From: France
Registered: 2008-09-04
Posts: 166
Website

Re: Share your Openbox Desktop ! :)

2964650769_b089cf08b1.jpg

Pypanel, Conky and  Idesk.

Offline

#395 2008-10-22 23:58:17

SysDump
Member
From: Brazil
Registered: 2008-08-10
Posts: 11

Re: Share your Openbox Desktop ! :)

Rydgel wrote:

awesome!

mind sharing your config files?

tks!

Offline

#396 2008-10-23 01:11:03

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819
Website

Re: Share your Openbox Desktop ! :)

froli wrote:
B wrote:
froli wrote:

It's conky.

I was interested in that too, thanks smile. And congrats with the nice desktop Froli smile.

Do you have a link to the Weather font too?

Merci beaucoup wink

Thanks dude!

I forgot where I found it so I uploaded it on my skydrive(I know, it's bad to use microsoft products sad)

You can download here

and... lol ... where are you from?

Belgium, Dutch part though wink.


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

#397 2008-10-23 04:15:51

MarCustomized
Member
From: Detroit, MI
Registered: 2008-09-05
Posts: 116

Re: Share your Openbox Desktop ! :)

2008-10-23-000749_1280x1024_scrot599.png.xs.jpg

Last edited by MarCustomized (2008-10-23 17:23:04)

Offline

#398 2008-10-23 11:30:21

Daisuke_Aramaki
Member
From: ++49/711
Registered: 2008-10-06
Posts: 651
Website

Re: Share your Openbox Desktop ! :)

Xyne wrote:
Daisuke_Aramaki wrote:

that's a picture of one of my simulated boolean networks, part of my work. i used the program Discrete Dynamics Lab, and runs on a console!

Thanks. I saw your reply just after editing my post. smile

EDIT
Is there a pkg/PKGBUILD available for that, or did you download it directly from the site?

i don't think this program is packaged with ne distribution. u can download the source from their site and fire up the executable. that shud be it. there are no major dependencies to be taken care of. Only thing is the fontpath shud be appropriately entered in the xorg.conf files and there is an issue with backing store, when u navigate from one window back to the console where ddlab is running, the graphics go blank! but this can also be set rite by adding an entry in xorg.conf. its also a great play tool to learn cellular automata and stuff! here are the appropriate links!

DDLab website

http://www.cogs.susx.ac.uk/users/andywu/ddlab.html

Download Link (Right Click and Save)
http://www.ddlab.org/download/ddm_2008_ … m06.tar.gz

cheers


"You know what I found? Right in the kernel, in the heart of the operating system, I found a developer's comment that said, `Does this belong here?`" -- Simon Lok about Linux kernel in 2005
Reflections on the Strange and the not so Strange
http://skinwalker.wordpress.com

Offline

#399 2008-10-27 01:51:19

capnmoney
Member
From: ~
Registered: 2008-10-17
Posts: 108
Website

Re: Share your Openbox Desktop ! :)

This is my first week with Arch and I'm loving it.  Just switched from fluxbox to openbox after lurking on the boards and seeing so many cool setups.  It'd be great if I could get some suggestions from the people who know what their doing.  I'm trying to keep things basic and clean since Arch is running off a thumb drive.

http://www.flickr.com/photos/22576182@N … 3/sizes/l/ 

http://www.flickr.com/photos/22576182@N … 6/sizes/l/ 

Let me know if you want to see any other configs

tint

#---------------------------------------------
# TINT CONFIG FILE
#---------------------------------------------

#---------------------------------------------
# PANEL
#---------------------------------------------
panel_mode = single_monitor
panel_monitor = 1
panel_position = bottom center
panel_size = 1600 25
panel_margin = 0 1
panel_padding = 6 2
font_shadow = 0

#---------------------------------------------
# PANEL BACKGROUND AND BORDER
#---------------------------------------------
panel_rounded = 7
panel_border_width = 0
panel_background_color = #ffffff 0
panel_border_color = #ffffff 0

#---------------------------------------------
# TASKS
#---------------------------------------------
task_text_centered = 1
task_width = 160
task_margin = 2
task_padding = 3
task_icon_size = 0
task_font = tahoma 8
task_font_color = #000000 80
task_active_font_color = #000000 95

#---------------------------------------------
# TASK BACKGROUND AND BORDER
#---------------------------------------------
task_rounded = 5
task_background_color = #ffffff 40
task_active_background_color = #ffffff 50
task_border_width = 0
task_border_color = #ffffff 18
task_active_border_color = #ffffff 70

#---------------------------------------------
# CLOCK
#---------------------------------------------
time1_format = %H:%M
time1_font = tahoma 9
time2_format = %B %d
time2_font = tahoma 8
clock_font_color = #000000 90

#---------------------------------------------
# MOUSE ACTION ON TASK
#---------------------------------------------
mouse_middle = none
mouse_right = close
mouse_scroll_up = toggle
mouse_scroll_down = iconify

Menu

<?xml version="1.0" encoding="UTF-8"?>

<openbox_menu>
<menu id="root-menu" label="Openbox">
    <separator label="Openbox"  />
    <item label="firefox"> <action name="Execute"> <execute>firefox</execute> </action> </item>
    <item label="thunar"> <action name="Execute"> <execute>thunar</execute> </action> </item>
    <item label="xterm"> <action name="Execute"> <execute>xterm</execute> </action> </item>
    <item label="geany"> <action name="Execute"> <execute>geany</execute> </action> </item>
    <item label="vlc"> <action name="Execute"> <execute>vlc</execute> </action> </item>
    <separator  />


<menu id="system-menu" label="system">
  <item label="obconf">
    <action name="Execute">
      <command>obconf</command>
      <startupnotify><enabled>yes</enabled></startupnotify>
    </action>
  </item>
  
    <item label="obmenu">
    <action name="Execute">
      <command>obmenu</command>
      <startupnotify><enabled>yes</enabled></startupnotify>
    </action>
  </item>
  
  <separator />
  <item label="reconfigure openbox">
    <action name="Reconfigure" />
  </item>
  <item label="exit openbox">
    <action name="Exit">
      <prompt>yes</prompt>
    </action>
  </item>
</menu>


</menu>
</openbox_menu>

Conky

#avoid flicker

double_buffer no



#own window to run simultanious 2 or more conkys

own_window  no

own_window_transparent yes

own_window_type normal

own_window_hints undecorate,sticky,skip_taskbar,skip_pager 





#borders

draw_borders no

border_margin 1



#shades

draw_shades no



#position

gap_x 0

gap_y 2

alignment top_middle



#behaviour

update_interval 1



#colour

default_color  9f907d



#default_shade_color 000000

own_window_colour 3d352a



#font

use_xft yes

xftfont bauhaus:pixelsize=10



#to prevent window from moving

use_spacer none

minimum_size 1262 0



#mpd

mpd_host localhost

mpd_port 6600


#D7D3C5

TEXT 
${color black}${alignc}Kernel: $kernel   |  ${execi 1800 perl /home/austin/scripts/conky-updates.pl}  |  Up: ${uptime_short}   |   Processes: $processes  Running: $running_processes   |  Cpu: ${cpu}%   |   Mem: $mem/$memmax - $memperc%  |   Net: ${font}${downspeed ath0} Kb/s ${totaldown ath0} down   |   ${upspeed ath0} Kb/s ${totalup ath0} up |  Home: ${fs_used /home} / ${fs_size /home} - ${fs_used_perc /home}%  |  Root: ${fs_used /} / ${fs_size /} - ${fs_used_perc /}% ${color}

Also, I'm having trouble with conky-updates.pl.  It doesn't look like the pacsync.sh is doing anything.  Is there anything I need to do to get it running?

#!/bin/bash

# This issues a command to 1. Sync the package database, 
# 2. Check for upgradable packages, 3. print the URL of any possible upgrade. 
# The output of our command gets written to updates.log, which we will use 
# conky_updates.sh to parse to see if there are any available updates.

pacman -Sy --noprogressbar > /home/austin/scripts/updates.log

thanks for looking

Last edited by capnmoney (2008-10-27 02:00:59)

Offline

#400 2008-10-28 19:00:51

thewayofzen
Member
Registered: 2007-06-10
Posts: 79

Re: Share your Openbox Desktop ! :)

21502091tu9.th.pngthpix.gif
I imagine this will be my last shot for october.
openbox
pypanel
conky
thunar
sonata.


icons are quickening found at gnome-look.org
openbox and gtk are unreleased created by me.

Last edited by thewayofzen (2008-10-28 21:49:25)

Offline

Board footer

Powered by FluxBB