Jump to page content

Bug of the moment 2008-01-20


A Tale of Two Desktops, Part Two

I did not take Part One especially seriously until less than a day later, something intriguingly similar cropped up on my iMac.

This second incident is akin to the sorts of strange experiments I perform to see how far I can push software and how badly it reacts, but this time it was completely real, and it had me very confused.

It started out with performing batch download tests on the iCab 4 Web browser, and noticing that freshly downloaded files were not showing up on my desktop as they should. I asked iCab to take me to one of the files, and it did:

However, this was clearly not the desktop that I was looking at:

View full-size screenshot

Who are you, and what have you done with the real desktop?

I right-clicked on one of the icons on the … the desktop that was on the desktop (!) and selected Get Info, and was most surprised at what I found:

The desktop had moved into ~/Documents/Downloads/Installers:

How on Earth could something like that happen? I pondered about it for a brief while, and then realised what had happened. I use the OnMyCommand AppleScript and shell script executor contextual menu module to extend the Finder’s context menus. One of the commands I created is called “Installers folder” and moves the selected items into my downloaded installer files directory:

tell application "Finder" to move { POSIX file "__OBJ_PATH__" } to folder "Installers" of folder "Downloads" of (path to documents folder)

This item is set to appear for any files and folders, and since the desktop is a folder, the menu item appears when you right-click the desktop:

So why did I now have two desktops? Both locations were completely regular folders (at least, so it seemed):

The Finder, on asked to move the desktop, simply obeyed willingly and as far as it was concerned, the desktop was now located somewhere else:

The Mac itself spotted that – to its eyes – the desktop had disappeared, so it hastily reconstructed a new one at the correct location. All other software was writing to the proper location, while the Finder was showing me the original desktop at its new location.

To be cautious and not create a worse mess, I decided I would rectify the problem they way I created it, using the Finder, via AppleScript:

At this point, I was still unsure of the nature of the problem, and got a nice error:

Therefore, the new desktop folder had to be removed first before the old one could be shuffled into place:

Finally, I had the desktop back the way it should be, and I could move all the refugee files – fleeing from potential danger – back onto it:

Bootnotes

The astute will wonder why the second screenshot of Terminal shows an unfocused window with a cursor on it. See, the Mac deposits screenshots to the desktop, and I was unable to take a screenshot normally after I’d removed the new desktop folder. Thus, I had to make use of Grab. Grab, however, is rather sucky and if you ask it to capture a given window, fails to focus the window first, leaving you with a screenshot of an unfocused window. This will explain why, in the past, I’ve seen such screenshots. The cursor is something I’d told Grab to show (well, add, from its stupid palette of fake cursors) and I forget to un-set it.

Mac OS itself has a strange limitation concerning grouped windows. While it is not possible to capture all windows in a group simultaneously, it is however possible to capture the Mac failing to capture the window group:

I cannot think of any other system where it is possible to take a screenshot of another screenshot in the process of being taken.


Posted 20th January 2008 – Comments and questions?