Which end is up?

Volume 11, Issue 70; 08 Dec 2008; last modified 08 Oct 2010

It's no secret that I need help staying organized. I multitask reasonable well, but only among the small number of tasks that have my attention.

Science is organized knowledge. Wisdom is organized life.

Immanuel Kant

Left to my own devices, I would rarely remember to perform any of the enormous number of mundane tasks of which life is composed. I'd function, but awkwardly. I'd forget to participate in teleconferences, I'd neglect to return phone calls, I'd forget to assemble the recycling on the curb, my hair would rarely be kempt,…you get the idea.

I use technology to compensate for my natural inabilities. I keep all of my appointments, contacts, etc. on my mobile phone. I sync my phone with my laptop, so no matter what I'm doing, there's a good chance that I'll be reminded to do the things I'm supposed to do.

That's good, as far as it goes. The alarm going off five minutes before the working group telcon reminds me to dial in. But reacting to everything five minute before it happens isn't ideal.

When I used Linux, I arranged things so that everytime I opened a shell window, it printed the day's remaining appointments. That worked very well, as I tended to open shell windows with wild abandon. Now that I'm on a Mac, however, I have two shell windows open all the time and I rarely create new ones. I really don't know why I work differently on the Mac, but I do.

Ever since I started using a PIM, I've made sure that I could get at all the data in XML. One of the very first things I did after I got an iPhone was figure out how to extract the Calendar and Contacts as XML. <aside>The fact that the Notes application doesn't sync in any reasonable way seriously irritates me and, as a result, I don't really use it.</aside>

Once the data is in XML, I can use off-the-shelf XML tools to format it. For example, like this:

Coming up:
............. TAG f2f (9 Dec 2008, 1 day)

............. Events on 8 Dec 2008
............. XML 2008 Conference
07:00a-07:10a Garbage and paper
03:00p-04:00p XML CG

That's the sort of thing I used to print at the top of each new shell window. But since I don't see new shell windows with any regularity anymore, the question is, how else to display it?

Not long after I joined Mark Logic, I converted the iPhone syncing stuff to use Mark Logic Server. I know it's better to bake than fry, but if your fryer operates at about a billion degrees, sometimes it's a lot simpler to fry. With a quick little dash of XQuery, I had a web page that displayed my daily calendar based on the most recent synced data: no muss, no fuss

My first thought was that I'd use a Fluid SSB to display the schedule. That worked fine, but it occupied screen real estate, which is precious. I stuck it way over on the right hand side, but it occluded part of the desktop so I was always moving it to get at some mounted drive or downloaded file. I keep almost nothing on the desktop, but it's a handy place to download .dmg files and, of course, the Mac sticks all mounted drives on the desktop.

What I really wanted, I realized, was to put the schedule in the desktop, so it would always be visible but it would be under whatever I or OS X splattered onto the desktop.

A little digging (and help from my followers on twitterThough I have an aesthetic preference for identi.ca.) lead me to webkit2png.

Getting webkit2png to work was a real struggle. I don't know if it's OS X 10.5 or if it's just me, but I could not get import WebKit to work in Python. After all of the obvious (and several of the obscure) things failed, with a little help from Paul Hammond, I came to the realization that it would work if I explicitly placed /System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/PyObjC in my PYTHONPATH. This causes cranky warnings, but it works.

Once I was able to turn web pages into graphics (which is kind of cool in its own right), I turned my attention to getting them onto the desktop. My, my, my, now there's a task that the Mac doesn't make easy. Well, programmatically easy, anyway.

The magic incantation appears to be this (in AppleScript):

tell application "Finder"
set desktop picture to {"Macintosh HD:Users:ndw:Documents:Graphics:Desktop:sched.png"} as alias
end tell

(Assuming the graphic is in /Users/ndw/Documents/Graphics/Desktop/sched.png.) There's some other incantation you can use to get AppleScript to understand POSIX filenames, but I didn't bother to work it out.

That's fine, except that if you change sched.png and run that incantation again…nothing happens. OS X tries to be smart and figures if you attempt to use the same filename twice, it doesn't have to do anything because that file is already displayed as the desktop. Nevermind that the contents of that file has changed.

So, you have to be a little more clever. You wind up with something like this:

#!/bin/bash

# Stupid AppleScript won't load the same picture twice, so we alternate pics
if [ -f ~/Documents/Graphics/Desktop/1.png ]; then
    rm -f ~/Documents/Graphics/Desktop/1.png
    FN=2.png
else
    rm -f ~/Documents/Graphics/Desktop/2.png
    FN=1.png
fi

cd /tmp
rm -f sched-desktop*.png
webkit2png -o sched-desktop -F http://localhost:8300/today.xqy > /dev/null 2>&1
convert sched-desktop-full.png -crop 325x300+0+0 sched-desktop-crop.png
convert sched-desktop-crop.png -bordercolor "#617187" -border 0x200 sched-desktop.png
convert ~/Documents/Graphics/BlankDesktop.png sched-desktop.png \
        -gravity NorthEast -composite ~/Documents/Graphics/Desktop/$FN
osascript - <<EOF
tell application "Finder"
set desktop picture to {"Macintosh HD:Users:ndw:Documents:Graphics:Desktop:$FN"} as alias
end tell
EOF

And a desktop like this:

Which works very nicely, thank you very much.

Comments

Along the same lines, have you looked at GeekTool? There's a good write up of it on Lifehacker if you need inspiration.

—Posted by Jeni on 09 Dec 2008 @ 09:35 UTC #

I use something called "MenuCalendarClock" to get closer to my appointements and tasks. It doesn't display anything on my desktop, but I hardly ever see that anyways.

MenuCalendarClock displays it's own "Time" Widget in the Menu Bar, and if you click it, there's a drop down with a small calendar and a list of your appointements (configurable today or this week, I think). Very useful IMHO.

—Posted by Martin Probst on 09 Dec 2008 @ 09:35 UTC #

GeekTool looks interesting; thanks for the pointer, Jeni!

Martin, I also use MenuCalendarClock. But there's usually a thin stripe of desktop visible on the right hand side of my display, so it's handy having something that's unobtrusively visible at a glance.

Oh, and a feature that my screen shot doesn't show because I took it late last night is that the next appointment is highlighted for an hour before it arrives.

—Posted by Norman Walsh on 09 Dec 2008 @ 12:24 UTC #

I was going to suggest MkConsole for displaying logs on the desktop but it looks like GeekTool has that covered. I switched back to linux when leopard was released and haven't kept up on OSX ware.

—Posted by Forest on 09 Dec 2008 @ 02:43 UTC #

Dude, I'm getting seriously jealous of the fun you're having with the Mark Logic XML server. I'm sure it's out of my price range, but maybe you could get them to open-source a useful subset? Tell them how it would increase their mindshare.

—Posted by isaac32767 on 09 Dec 2008 @ 06:45 UTC #

Isaac((2^15)-1)

For non-commercial applications, check out the Community License.

—Posted by Norman Walsh on 10 Dec 2008 @ 03:42 UTC #