Show the date and time in Pekwm’s menu

January 2, 2008

One of the nice features of Pekwm is that it allows you to use dynamic menus, menus and entries that display the output of a script that is run each time the menu is accessed. Here is how you can display the time and date in your root menu (or window menu, if you’d like that). I’ve adapted what follows from here.

Create a new file in a place that is convenient for you. (I keep such dynamic menus in a subdirectory called “menu” in the ~/.pekwm directory.) Add the following to that file:

echo "Dynamic {"
echo " Entry = \"`date +'%a, %e %B - %H:%M'`\" { Actions = \"Exec osmo & \" } "
echo " }"

Make the script executable (chmod +x /path/to/script), and add the following to your menu file (in ~/.pekwm):

Entry = "" { Actions = "Dynamic  /path/to/the/script"}

If you reload Pekwm, you will have a menu item that displays the time and date. If you click on the time and date, Osmo, a nice light calendar, todo list and contact management application, will launch. Replace it in the above command with any other application you like (Orage, dzen with a calendar script, etc.). If you prefer not to have any application linked to the entry, use the following line in the above script (instead of line 3):

echo " Entry = \" `date +'%d.%m.%y - %H:%M'`\" { Actions = \"Exec source /dev/null & \" } "

If you want the date and time to display in its owm submenu, add the following to your menu file:

Submenu = "Date and Time" {
	Entry = "" { Actions = "Dynamic  /path/to/the/script"}

You can also easily change the date and time format to your liking. Below are two screenshots; the first shows the date and time on the main menu with the command `date +’%d.%m.%y – %H:%M’`, the second shows it in a submenu with the command `date +’%a, %e %B – %H:%M’`.

Pekwm time and date

3 Responses to “Show the date and time in Pekwm’s menu”

  1. pibarnas said

    Niiiiiice!!! Great! Thank you very much, pal! =D

  2. […] dynamiques. Ce sont des entrées de menus générées par des scripts. Vous trouverez un exemple ici pour afficher la date et l’heure […]

  3. […] You can find some dynamic menus online. Check the exact syntax the menu requires, as they can vary. There are not that many dynamic menu scripts around, unfortunately. You can find and example of a dynamic menu, used to display the time and date, here. […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s