One of the toys I’ve come to appreciate running on my Mac, is a little utility called GeekTool…
What makes GeekTool cool, is that it allows you to embed different items into your Mac desktop, so it is quite easy to use it to display a text file, for instance (like your system log) or to scrape a ticker-tape from the web and use that to keep track of your favourite Stock Price, but it is also possible to do much cooler stuff…
A quick example of what is possible was featured on LifeHacker, where they embed the venerable Unix “cal” command in the desktop, and using some “sed” slight-of-hand they even mark the current day on the calendar.
“Very Cool”, I thought, “except…”
Well, yes, except. I would have preferred not losing the day, but rather marking it in some way.
But before I get to that, I need to digress a bit first, though.
There are some thinks I would really like in this world. Peace. Children being able to play together for more than a few minutes without fighting. Winning a big one on the Euro Lottery. GeekTool being able to display HTML. But alas…
And since GeekTool would not allow me to embed HTML (or any other markup I could tell: I would have settled for Markdown or even RTF) I tried to work around the problem…
After a couple of iterations (and careful selection of the font GeekTool used to display my resultant calendar) I finally settled on the following:
cal| sed "s/^/ /;s/$/ /;s/.*
date +'%B %Y'.*//;/^$/d; \ s/
This got me a nice-looking calendar with the day-of-week marked by some parentheses:Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 (24)25 26 27 28 29 30 31
In doing this, I also got rid of the Month and Year since I already have another Geeklet that displays that on my Desktop:
That displayed okay, I guess, but I was still (slightly) disappointed. Then it struck me: I was being an utter dunce. I had already been overlaying the other script Geeklets to get the Date/Time display I had wanted; there was nothing stopping me from generating two calendars, one on top of the other, one with the current day edited out, and the other only containing the current day, in the correct spot. That way the second could be displayed in another colour and give me the result I had sought.
So, without further ado, I cooked up the following. First, the easy one. Here is the script for displaying the calendar with the current day masked out:cal| sed "s/^/ /;s/$/ /;s/^ Su.*//;s/.*
date +'%B %Y'.*//; /^$/d; s/
date +%e/ /g;"
The second stumped me for a bit, till I realised I was doing my usual: over-thinking the problem. This is the script I used in the end:cal| sed "s/^/ /;s/$/ /;s/^ Su.*//;s/.*
date +'%B %Y'.*//; /^$/d; s/
date +%e/ ## /g; s/[0-9]/ /g; s/ ## /
In these I also deleted the Day strip at the top and added a Geeklet containing the days of the week in the more traditional three-letter format. By dropping the font of that to 18 points as opposed to the other two’s 24 points, I managed to for it all in perfectly:
Now all of them fit together rather nicely, and I’m a happy(er) person.
For anyone curious enough to know how I had all of these placed to get them to work together (both of you), here it is:
For everyone else… I apologise?