Just annotations of little "how to's", so I know I can find how to do something I've already done when I need to do it again, in case I don't remember anymore, which is not unlikely. Hopefully they can be useful to others, but I can't guarantee that it will work, or that it won't even make things worse.
A clock as the header of Openbox' root menu
If you want a clock instead of the typical "openbox"-labeled separator at the top of the root menu. The way to do that isn't the most nice and convenient way imaginable, though. Essentially you have the root menu as a pipe menu.
The executed script is just a sed one liner:
This a "24 hour" clock format, without leading zeros, but can be changed "12 hour"format, or to some sort of display of time in time-yards and time-inches, if "date" does that.
Where this "menu-sed" would be essentially the "static" openbox root menu, a copy of menu.xml, only changed slightly to have the proper "headers" and "footers" or, more precisely, xml tags:
And the actual menu.xml looks like:
A subtly different alternative approach:
And the "body" file obviously hasn't the xml "header", neither the clock line. I think it gives obscenely humanly indistinguishably better results, specially if its a "#!/bin/sh" script.
That's all. I suggest to backup the original menu.xml if you're attempting to do that, and it's also handy to have a reachable/open-and-always-on-top terminal window, if something go wrong and suddenly you don't have any menu at all, so you can restore the backup or fix whatever and do "openbox --reconfigure" without logging out or rebooting, like only a log-outer or a rebooter would do.
The executed script is just a sed one liner:
Code:
sed "s|INSERT-CLOCK-HERE|$(date +'%-H:%M')|" $HOME/.config/openbox/menu-sed.xml
Where this "menu-sed" would be essentially the "static" openbox root menu, a copy of menu.xml, only changed slightly to have the proper "headers" and "footers" or, more precisely, xml tags:
Code:
<?xml version="1.0" encoding="utf-8"?> <openbox_pipe_menu> <separator label="INSERT-CLOCK-HERE"/> [...] </openbox_pipe_menu>
Code:
<?xml version="1.0" encoding="utf-8"?> <openbox_menu xmlns="http://openbox.org/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://openbox.org/ file:///usr/share/openbox/menu.xsd"> <menu execute="some-pipe-menu.sh" id="somepipemenu" label="some pipe menu"/> <menu execute="some-other-pipe-menu.sh" id="otherpipemenu" label="other pipe menu"/> <menu execute="obclockmenu.sh" id="root-menu" label="Openbox 3.5"> </openbox_menu>
A subtly different alternative approach:
Code:
printf "<?xml version=\"1.0\" encoding=\"utf-8\"?><openbox_pipe_menu><separator label=\"$(date +'%-H:%M')\"/>" ; cat $HOME/.config/openbox/menu-body.xml
That's all. I suggest to backup the original menu.xml if you're attempting to do that, and it's also handy to have a reachable/open-and-always-on-top terminal window, if something go wrong and suddenly you don't have any menu at all, so you can restore the backup or fix whatever and do "openbox --reconfigure" without logging out or rebooting, like only a log-outer or a rebooter would do.
Total Comments 0