How do I draw the desktop on Mac OS X?
- by Dominic Cooney
I want to draw the desktop on Mac OS X (Snow Leopard). Specifically, I want to achieve the same effect as running:
/System/Library/Frameworks/ScreenSaver.framework/Resources/
ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -background
(If you’re not near your computer, this displays the screensaver where you would normally see your desktop background.)
I know how to make a window without a border (by subclassing NSWindow and overriding initWithContentRect:styleMask:backing:defer: to set the window style to NSBorderlessWindowMask) and without a shadow (setHasShadow:NO.)
I know that I can call setLevel:kCGDesktopWindowLevel or kCGDesktopIconWindowLevel to put my window below other windows (see question 418791.) However this isn’t exactly what I want, because a window at this level is still on top of the desktop icons. I want to be on top of the desktop background, but below the icons.
My view is opaque. If there is a technique that clobbers the desktop background, that is OK.