1

Is it possible to hide or unhide the desktop icons on a Mac with a fade effect? This could be potentially done by placing a image of the wallpaper over the actual desktop, so that when the desktop is clicked, the icons would appear.

Could an approch like this be sandboxed?

2 Answers 2

3

The basic approach would be to create a borderless NSWindow with an appropriate level. kCGDesktopIconWindowLevelKey is the level of the desktop icons, so that should work.

Sandboxing is not a problem for this because you don't actually remove the desktop icons, you just display a window on top of them.

You'll probably also want to set the collectionBehavior of the window to NSWindowCollectionBehaviorStationary, so that it's not affected by Exposé.

9
  • WOW there's even a Variable for the Icon Level ? That's great ! Thanks a lot for your answer ! So it is indeed possible :D As you seem very experienced, omz, could you maybe also tell me if it would be possible to hide the icons again when the user double-clicks the desktop ( not the icons ). Really appreciate your help here! Jul 4, 2012 at 0:34
  • I can't think of a way to do that. It might be possible to detect clicks on the desktop using [NSEvent addGlobalMonitorForEventsMatchingMask...], but you couldn't distinguish clicks on the background from clicks on the icons...
    – omz
    Jul 4, 2012 at 1:44
  • Thanks anyways. Would have been great if it could have worked that way, but maybe I should just do something like hot corners. Jul 4, 2012 at 10:30
  • One Last Question: Is it possible to fade the overlay when the user drags a file on the desktop (on drag event ?). E.g.: The user wants to drag a file to the desktop, and while he hovers over the desktop, the icons fade in. Jul 4, 2012 at 10:36
  • Well, to show the desktop icons when a drag enters your overlay windows, you'd just have to handle the "drag entered" event in your window/view. The hard part would be to hide the icons again when the drag'n'drop operation ends. I'm not sure if that's possible at all.
    – omz
    Jul 4, 2012 at 14:22
0

I'm not sure if this is possible, because:

  1. The overlay would have to be over the desktop, but under new windows
  2. This would most likely not be able to be sandboxed

But if you could it to work, the workflow would be along the lines of:

  1. User clicks button (preferably menubar, as this app doesn't really have a window)
  2. A full screen window (with UI elements disabled, such as menubar) fades in with the background image set as the Mac's background image
  3. Clicking the button again would hide the window
4
  • Mh .. how's about hiding/unhiding icons on the desktop with the same (on click) system, but without an image overlay for the fade. So they just appear. Would it be possible to make them appear on click on the desktop, while still retaining to the sandboxed guidelines ? Jul 3, 2012 at 19:03
  • I do not believe you will be able to sandbox this, as it's going to need to modify key OSX elements. Here's a link, developer.apple.com/library/mac/#documentation/Security/…
    – Charlie
    Jul 3, 2012 at 19:18
  • Yeah, I knew that page. Although there are other AppStore Apps that can hide the icons. So, you think only the action "click-desktop-to-show" would be un-sandboxable ? Jul 3, 2012 at 19:36
  • What's an example of one of these apps?
    – Charlie
    Jul 3, 2012 at 19:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.