I just stumbled across something interesting today while poking around
rcd (the daemon that farms out remote control events). If you send the
NSDistributedNotificationCenter notification name
@"com.apple.dashboard.dismiss" (no object or userInfo dictionary) then Dashboard hides itself. That’s pretty neat!
On a side note, it turns out there is no way to hack
rcd to farm remote control events out to non-Apple programs. It has all the appleevents and such that it uses hardcoded in. I was really hoping they did something like implement a generic remote control AE that they sent to any app that cared, but no, if you’re not iTunes, DVDPlayer, iPhoto, QuickTime Player, or Keynote, you won’t see hide nor hair of the events.
Update: Turns out there’s a companion
@"com.apple.dashboard.awake" notification as well that, you guessed it, brings Dashboard forward.