How do I draw the desktop on Mac OS X?

Posted by Dominic Cooney on Stack Overflow See other posts from Stack Overflow or by Dominic Cooney
Published on 2011-02-13T05:20:12Z Indexed on 2011/02/13 23:25 UTC
Read the original article Hit count: 293

Filed under:
|
|
|

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.

© Stack Overflow or respective owner

Related posts about cocoa

Related posts about osx