4

I want to create analog of program conky. What is the best way to draw information on a OS X desktop?

Igor
  • 1,258
  • 2
  • 14
  • 20

3 Answers3

12

NSWindow has a method, setLevel:, that lets you control how the window is positioned compared to other windows. From my own experience, you might want to try feeding it kCGDesktopIconWindowLevel, and calling setHasShadow:NO to implement the look you want. To actually do the drawing you would put a custom NSView subclass in your window, and create the window without a frame (see NSBorderlessWindowMask) and transparent ([window setBackgroundColor:[NSColor clearColor]], [self setOpaque:NO];).

You might also want to take a look at this article to keep your window pinned to the desktop during an Expose event.

Marc Charbonneau
  • 40,399
  • 3
  • 75
  • 82
  • 1
    The DontExposeMe hack breaks compatibility with Spaces. I wouldn't recommend it. Fortunately, if your window is at the desktop-icon level, Exposé shouldn't touch it. – Peter Hosey Jan 07 '09 at 04:12
3

Have you tried GeekTool? Maybe you don't even have to write the app. ☺

Peter Hosey
  • 95,783
  • 15
  • 211
  • 370
2

You need to take a look at using NSWindowLevel with a transparent window.

Sophie Alpert
  • 139,698
  • 36
  • 220
  • 238