Show/Hide DesktopShelves using a Hot Corner
Here’s how I setup a Hot Corner to show or hide my DesktopShelves.
(Note that this trick can also be used to launch any program or AppleScript using a Hot Corner.)
The magic lies in a nice piece of software written by Matt Swann: ScriptSaver
This screen saver will in fact execute any AppleScript you specify instead (or before) launching a screen saver.
Here’s step-by-step instructions for how to use it to show & hide your DesktopShelves:
-
Download ScriptSaver
-
Download the AppleScript I created: ActivateDesktopShelves.scpt or, if you’d like to use the iPhoto screen saver instead of the standard ones (Arabesque, Flurry, …), use this script instead: ActivateDesktopShelves-iPhotoScreenSaver.scpt
-
Download MouseLocation[1] using Terminal.app. (Just paste the complete line below in Terminal.)
curl -so /tmp/MouseLocation.zip https://www.pommepause.com/assets/2011/10/MouseLocation.zip ; unzip /tmp/MouseLocation.zip ; sudo mv MouseLocation /usr/local/opt/
-
Extract the AppleScript from the above download, and put the .scpt file in ~/Applications (or anywhere really!)
-
If you’ll be using ActivateDesktopShelves.scpt, open it in AppleScript Editor (just double-click it) and change the 2nd line from the bottom to start your preferred screen saver. The default is “Flurry”, and the list of available screen savers appears just above that line. Save it once you’re done.
-
If you’ll be using ActivateDesktopShelves-iPhotoScreenSaver.scpt instead, there’s two additional steps:
-
Go in System Preferences, and select the iPhoto screen saver. Chooses the options you’d like to use.
-
In Terminal, create a copy of the screen saver preferences file. (Just paste the following 3 lines in Terminal.)
uuid=
/usr/sbin/system_profiler SPHardwareDataType | grep 'Hardware UUID' | cut -c22-57
file=~/Library/Preferences/ByHost/com.apple.screensaver.$uuid.plist cp $file $file.iPhoto
-
-
Install ScriptSaver: double click the ScriptSaver.saver file
-
Click Options…
- Activation Script: select the .scpt file you downloaded above (in ~/Applications)
- Run asynchronously: checked
- Screen Saver: None
- Deactivation Script: empty
- Show desktop while synchronous scripts execute: checked
-
Click Hot Corners… Assign one or more Hot Corner to Start Screen Saver. The AppleScript will detect if the mouse is in a corner, and if so, will launch DesktopShelves.app, which will in turn display your shelves.
If the mouse isn’t in a corner, then your screen saver will start.
Voilà! A nice way to start any app using a Hot Corner, and a nice way to use DesktopShelves only with your mouse.
Footnotes
[1] MouseLocation is a simple Objective-C executable created using the following code:
#import <AppKit/AppKit.h>
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSPoint mouseLoc = [NSEvent mouseLocation]; //get current mouse position
NSString* locString = [NSString stringWithFormat:@"%.0f, %.0f", mouseLoc.x, mouseLoc.y];
printf("%s\n", [locString UTF8String]);
[pool drain];
return 0;
}
Compiled using the following command (Xcode required):
sudo gcc -o /usr/local/opt/MouseLocation MouseLocation.m -framework AppKit