Drag-and-drop and application switching

Everyone is probably well aware of the OS X application switcher, accessed via Command-Tab. Added in OS X 10.3, when invoked, this feature presents a row of icons across your screen, ordered by most to least recent usage. This makes it simple to work between two applications, as you can use Command-Tab to cycle between the two most recent applications.

There are also some hidden features of the switcher that we’ve covered here before—with an application highlighted in the switcher, press H to hide it or Q to quit it. You can also choose which app to switch to in a number of ways—using the scroll wheel on your mouse, the arrow keys on the keyboard, or just by moving the mouse over the icon you wish to activate. But what we haven’t previously discussed is how the application switcher interacts with drag-and-drop operations.

Simple drag-and-drop

Did you know you can use the application switcher after starting a drag operation? Start your drag, press Command-Tab, and there’s the switcher. Why might you want to do this? Say you want to drag and drop something into a TextEdit document, but you’ve hidden TextEdit, so you can’t see its windows. No problem; drag the object you wish to drop, activate the switcher, and then Tab over to TextEdit (still keeping the mouse key depressed, so as to not cancel your drag operation). Release Command-Tab when TextEdit is highlighted, and it will activate and unhide. Now you can complete your drag operation, dropping your dragged item into the TextEdit window.

Note that you can’t drag and drop an object directly onto an application’s icon in the switcher—you have to use the switcher to first activate the destination application, then drop your dragged object. If you’d like to drag and drop directly onto the application switcher itself, you might want to try Proteron’s $15 LiteSwitch X, which has that capability (as well as some other useful features, such as resizable icons).

Advanced drag-and-drop

Beyond just drag-switch-drop, though, there’s more you can do with the application switcher active. Consider the prior example. Only this time, after unhiding TextEdit, you discover that you didn’t leave a new document window onscreen to accept your dragged item. You might think you’ve got to cancel your drag operation, create a new document in TextEdit, and start the process over again. But that’s not the case.

After starting your drag and switching to TextEdit (that is, you’ve released Command-Tab), just press Command-N to create a new window. The command will be sent to TextEdit, even though you’re in the middle of a drag operation.

Drag-and-drop and application interaction

You’re not limited to Command-N with the above trick— any keyboard shortcut can be sent to any application while you’re dragging. Note that this only works if you’ve switched to that application via the application switcher (or by using Exposé). If TextEdit is active already, for instance, and you drag a file over one of its windows, none of the keyboard shortcuts will do anything. But if you’ve come to TextEdit via Exposé or the application switcher, you’ve got full access to any keyboard shortcuts.

Although my examples all use TextEdit, these tricks work with any application. Drag an object, activate Excel, and notice you’ve got the wrong window in the foreground as a drop target? Press Command-` until the proper window comes forward, then drop you dragged object. You can even do amazingly tricky stuff. As an example, say you wanted to drag-and-drop a small text file into a certain spot in your Word document. You drag, switch apps, and then find that you’ve closed the document. No problem; press Command-O (while keeping the mouse button pressed) to bring up the standard Open dialog in Word. Now, since you’re using the mouse to drag your file around, you can’t use it to navigate the Open dialog box. But the arrow keys work just fine. Use them to navigate to the file you need to open, then press Return to open it. Now move the mouse around in the document until you find your desired insertion point, and (finally!) release the mouse button. (This is a much simpler thing to do if you use a mouse or trackpad that supports drag lock, which lets you “lock” the mouse button down so you can release it.)

Mac OS X’s robust drag-and-drop support is just one of the reasons why I find the system so pleasant to use—though you might think “there’s no way this is going to work” when you try something, it’s surprising just how often it actually does work!

Subscribe to the Best of Macworld Newsletter

Comments