Archive

Posts Tagged ‘scripts’

What time is it?

February 9, 2009 Leave a comment

People using a panel probably has a clock somewhere in there. I know I did, when I used gnome-panel and then later pypanel/tint2 with openbox. Recently, though, I changed to pure openbox, with no panels and system tray. Yes, thats kinda boring, but I still use an old 15″ CRT display and screen real estate is something I don’t like to waste.

Now, while openbox’s key bindings took care of my window managing needs, I started missing the small little clock at the corner. I had conky set up just to display the time and date, but more often than not, it was under the browser or the pdf I was glancing through.

A panel, just for the sake of a clock? Nah thats just preposterous. Then I realised that I already had xbindkeys running, for the mpd controls and all that. So I wrote a really-tiny-little script that displays the time, date and battery for 5 seconds and then goes away.

For the time being, its just a shell script running in an urvtc instance. Maybe someday I will put it in zenity or something like that. However, for what its worth, it shows me the time at a key press, and lets me carry on the good work.

#!/bin/zsh
echo “DATE :: $(date +”%Y, %dth %B – %A”)”
echo “TIME :: $(date +”%r %Z”)”
echo -n “BATTERY :: $(acpi|grep -Eo “[0-9%,:]{3,}”|tail -n1)”
sleep 5
exit

Nice and easy, and a proof of the insane customizability of a linux desktop.

Categories: Linux Tags: