92

Edit: The original accepted answer is no longer valid for Mavericks. I am keeping it accepted for historical reasons, but all readers using Mavericks should use and up-vote this answer.


By default, pressing +tab will display a list of all open applications. I would like that list to only include applications in the current space, or at least give priority to applications with windows in the current space. In other words, I'd like OS X to mimic the behavior of most X window managers with respect to their workspaces/virtual desktops.

Here's my rather long-winded explanation of why I want this:

I have disabled spaces' auto-switching, and I've mapped each space to a +space # shortcut. In general, I usually have one application open per space, maximized. Since I really only ever have a half-dozen or so applications open at any time, I can easily switch between them in constant time with my left hand. The problem is that I sometimes do have two or three windows from different applications open in the same space (e.g., I often have a PDF reader open in the same space as my web browser). Let's say I have a terminal open in Space 1 and both a web browser and Preview open in Space 2. If I am in the terminal and then decide I want to open a web page, I switch to Space 2, where the web browser has focus. I then want to consult a PDF that is open in Preview, which is in the same Space but whose window is behind the web browser. If I hit +tab, however, the first option will be to take me back to Terminal in Space 1 (since Terminal most recently had focus). In the worst case, I will have to cycle through all n open applications by repeatedly pressing +tab in order to get to Preview. I want the first hit to +tab to bring me to the next application with windows in the current space, i.e., Preview.

I know that using Exposé is the more "Apple" way of handling these situations, but I want to avoid having to reach for the mouse. I know I can also use the arrow keys to select a window in Exposé, but once again that breaks my mental model of the window layering, will institute a cognitive feedback loop in the selection, and will require worst case log(n) keystrokes. As far as I know, there is no constant-time way of switching to a specific application in the current workspace using only the keyboard.

  • There are a couple of packages that offer enhancements/replacements for the built-in application switching. You might want to consider contacting the developers of one or more of these packages and let them know you would be interested in Spaces specific switching. – David Rouse Dec 29 '10 at 16:34
  • I am familiar with (although I have never used) Witch; are there any others at which I should look? – ESultanik Dec 29 '10 at 16:43
  • I've seen mentions of LiteSwitch and App Switcher, but I haven't used any of these. – David Rouse Dec 29 '10 at 20:31
  • 1
    (this isn't an answer, more of a wish/rant!) This is exactly how things should work: 1. OSX should expose a number of 'sets' such as "all apps", "all apps in current space", "all windows in current app", "all tabs in app", etc. 2. Several 'movements' should be supported such as "next/previous in set", "number in set", "previous in history", etc. That last one is what's often missing below the app level and is vital for switching back and forth between, e.g. a couple of different tabs Now let me configure any combination of the two. Please, if an apple employee is reading, make this happen – Bobby Jack Oct 29 '15 at 13:34
42

control+F4. Cycles through the applications in that Space.
(I actually have this mapped to control+`; which I find easier to remember, being close to the cmd+`; to cycle through an application's windows.)

To change the keyboard shortcut, go to the Keyboard preferences, Keyboard Shortcuts, and Keyboard & Text Input. It's the 'Move focus to active or next window' option.

(Edit to fix the keyboard shortcuts; I didn't realise that the backtick character wasn't showing up.)

  • 3
    I think must use CTRL+fn+F4. – Am1rr3zA Feb 1 '11 at 8:04
  • @Am1rr3zA It depends on what kind of keyboard you have. – ESultanik Feb 1 '11 at 16:44
  • 3
    I think this isn't quite what was asked. CTRL+F4 switches between windows in the current space, but the question was about switching between applications in the current space. I point this out because I have 2 terminal apps and 1 Emacs app open in a space, and I want to easily switch between the terminal windows and the Emacs app. Maybe I'll ask another question... – Jeff Terrell Ph.D. Dec 16 '13 at 15:51
  • 2
    This keyboard shortcut is no longer present in System Preferences as of Mavericks. – Cory Klein Apr 25 '14 at 17:58
  • 1
    i notice there's an issue unless you specifically click on the app window itself in the new space (if you switch to a new space and use the shortcut, it switches back to the previous space) – dtc Oct 18 '14 at 8:59
24

Yosemite

This behavior can be mapped to your desired key combination like so:

System Preferences > Keyboard > Shortcuts > Keyboard > Move focus to active or next window

Mavericks

^F4 does switch through windows in the current space but you may have to upgrade to Yosemite to map this behavior to ^~.

But the problem can still be alleviated like so:

System Preferences > Mission Control > Uncheck "When switching to an application, switch to a Space with open windows for the application"

  • 1
    I have successfully remapped ^F4 to ^~ in Yosemite, so perhaps they fixed that bug? – Glyph Dec 9 '14 at 2:31
8

I know Hyperswitch didn't exist when that question was asked, but it is a modern answer to that question, and it is much better than hacking with Karabiner (formerly KeyRemap4MacBook) and/or struggling with the system preferences (since they don't accept any key mapping for every command).

Please see https://apple.stackexchange.com/a/127414 and upvote it if you find HyperSwitch useful.

  • 1
    Hyperswitch solves exactly what @ESultanik was asking for. Cmd-Tab still is the traditional app switch (with the added screenshot of the app windows and in which spaces they are), plus alt-tab switches only between the apps within the current space – hansaplast Dec 4 '16 at 12:41
2

As an aside to this answer, I've been able to remap control+F4 to alt+tab, which feels quite natural imo.

  • this command does not show any preview as the original alt tab – Fabrizio Bertoglio Jul 4 at 5:28
2

Pressing ⌃F4 will do what you're asking for, but you might get carpal tunnel in the process.

Just from reading your example, it sounds like you may actually be looking for ⌘⇧⇥, which cycles through applications in reverse order, thus cutting the number of times you press in half.

Granted, that's not be a constant time solution, but I think you'll find that the result of ⌘⇥ is the application you want to focus on 70% of the time, and ⌘⇧⇥ is the application you want to focus on 28% of the time.

  • 1
    For me, ⌘⇥ is right about 50% of the time, and the other 50% is about log(1.5)ly split between the other apps. – Sparr Jul 23 '12 at 16:51
  • Plus one for carpal tunnel :D I think Apple wants developers to get one... I bet they own shares in some medical industry company treating ergonomic diseases :) – Srneczek Sep 21 '16 at 11:31
1

I'm the author of the Command-Tab Plus application which allows you to quickly switch between applications, and additionally between windows (using MacOS's cmd+tilde ability). Here's a demo on YouTube.

  • Unfortunately it is paid. :( – markroxor Jan 19 at 5:41
0

You can try with Switché. They pretend that "Switché works great with Spaces and is able to display Space number badges". As I'm not using Spaces I cannot confirm nor infirm but it's worth the try.
See comments below.

  • 2
    Try it, but be aware switche has a really crappy demo. It has a popup asking you to buy every 3 or 4 times you switch windows. Drove me nuts in about 20 minutes and I uninstalled it. – Robert S Ciaccio Dec 29 '10 at 19:30
  • Switché shows all open apps. It does not do what the OP requests. – user588 Feb 1 '11 at 5:29
  • Hmm, I don't remember the numerous nag screens when I tested it some time ago. Doesn't deserve then to be publicized. I edited my answer. – LudoMC Feb 1 '11 at 21:46
0

Although this doesn't technically answer the original question, those here looking for a more configurable Cmd-Tab app switcher could look at SuperTab .

Disclaimer: I bought this and it think it's well done.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .