Step 1
Code for the Openbox root menu, add this code somewhere in your root menu:
Code: Select all
...menu stuff here...
<separator label="Calendar and Clock"/>
<menu id="date" label="Today's date" icon="/path/to/desired/icon" execute="sh /path/to/date-menu.sh" />
<menu id="time" label="Current time" icon="/path/to/desired/icon" execute="sh /path/to/time-menu.sh" />
...menu stuff here...
Step 2a
The date script. Save this code as a bash script named date-menu.sh and make it executable - I saved mine in ~/bin:
Code: Select all
#!/bin/sh
#
vardate=$(date +'%B %d, %Y')
cat << EOFMENU
<openbox_pipe_menu>
<item label="$vardate" />
</openbox_pipe_menu>
EOFMENU
Step 2b
The time script. Save this code as a bash script named time-menu.sh and make it executable - I saved mine in ~/bin:
Code: Select all
#!/bin/sh
#
vartime=$(date +'%l:%M %p')
cat << EOFMENU
<openbox_pipe_menu>
<item label="$vartime" />
</openbox_pipe_menu>
EOFMENU
Step 3
Restart, or Reconfigure, Openbox to see the new menu items. Now you have the date and time in the root menu - the scripts will run each time you hover the mouse cursor over the parent menu items (Today's date and Current time), respectively.
Documentation
If needed, the official Openbox menu documentation can be found here: http://openbox.org/wiki/Help:Menus
Screenshot
And, finally, a screenshot: