Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In Windows, I can swtich to the application that is opened in the taskbar using Windows + Number Key. Is there a similar shortcut key in mac to switch to opened applications in Dock. Or is there a way to assign shortcut keys to open applications.

Use Case:

I want to switch between my opened Firefox and Terminal and Sublime Text using shortcut keys, instead of using Alt + Tab.

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

There is no such feature built in. You have several options to achieve a similar effect yourself:

  • Use a launcher, such as Quicksilver or LaunchBar. They'll learn your preferences or let you assign keys to certain applications, so that you can quickly switch between applications no matter what their Dock positions are by e.g. typing a hotkey and a single letter.
  • Create scripts such as tell application " Terminal" to activate in AppleScript editor. You can assign them keyboard shortcuts in FastScripts.
  • Create Automator workflows with the Launch Application action for each of the programs, and assign keyboard shortcuts in System Preferences » Keyboard » Keyboard Shortcuts » Services.
  • For Terminal specifically, you could use Total Terminal, a hud-style terminal.

If you want to access the Dock item at a specific position rather than a specific application, you can use UI scripting in AppleScript: Enable the keyboard shortcut to focus the Dock in System Preferences » Keyboard » Keyboard Shortcuts » Keyboard & Text Input and Enable access for assistive devices in System Preferences » Accessibility. Now you can create a script such as the following script, which (usually) activates the third Dock icon from the left:

tell application "System Events"
    # press Ctrl-F3
    key down control
    key code 99
    key up control

    # right arrow twice
    key code 124
    key code 124

    # enter to confirm
    key code 36

    # focus Dock again
    key down control
    key code 99
    key up control

    move left twice to re-set to original position
    key code 123
    key code 123

    # Escape to close
    key code 53
end tell

It's not a reliable solution though, as the Dock remembers the last focused element and requires you to reset the position afterwards. Your own use of the keyboard to access the Dock will interfere with this script.

share|improve this answer
    
Thanks for the detailed answer. I will check the QuickSilver or Launchbar. –  John Mar 22 '13 at 21:27
add comment

You could also use scripts like this:

tell application "System Events" to tell process "Dock"
    click UI element 6 of list 1
end tell

Or just assign shortcuts to applications directly.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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