Macro to Toggle Between the Last 3 Apps Used

I wanted the same thing, but took a different route:

The only reason I share is that sometimes the second-to-last application isn't what I thought it would be. So if I press shift F14 it brings back the third-to-last. I use them both ALL the time, and have a similar arrangement for app windows.


Thank you very much. You icon is superb by the way.

I am very interested but don't quite understand

  • is shift F14 a different macro using %Application%3% ?

  • How do you do this with windows and for what kind of use ?

thanks again

Okay (and apologies to viewers who feel I am forking the topic.)

  • Yes @ronald shift-F14 (in my case) triggers a separate, similar macro where %Application%3% is targeted instead.

  • Re Windows: well both BBEdit and Chrome come to mind, when I am bouncing between this window and that last one a lot. For windows, the macro is even easier

    (That's the shift version, third-last window) I'm only going on about this because I find these macros super helpful.

Now that I think about it, I hardly ever trigger the F14 application switch any more, because I have a Better Touch Tool swipe gesture to trigger it. BTT is another game-changer folks.

Finally, thanks for the icon appreciation. One day I watched Alec Baldwin in "The Shadow" and got inspired.


thank you. I am used to toggling the last apps.

You have an excellent suggestion but now I have to figure out a way to toggle not 2 but 3 last apps and windows. Less shortcuts than having one for each app and window.

@hello : would you have an idea on how to toggle 3 apps or windows.
The actions to actually display the apps and windows are shown above. The question is how to handle the toggle. thanks !

Hi @ronald, take a look at the App Witch. I've been using it for years :wink:


Nice to hear from you !
Thank you for the suggestion. I have Witch, but don't see a way to toggle precisely the 3 last windows

1 Like

@ronald You can easily switch back and forth between Apps, App windows and Spaces.
Here is an example video:

1 Like

The most boorish way would be to, on key press, set 3 variables, and additional to that, make a calculation with them, so they are rotated accordingly.

I’m assuming you want to use only 1 hot key to switch between the three last apps, is that correct?

If you use those apps very often, it might be more practical to just set up a global macro to call each app, I.e.:
CTRL-S to activate Safari
CTRL-M to activate Mail app

That way you can just use the shortcuts as mnemonic.

1 Like

I will try it out again. Thank you very much @appleianer.

1 Like

I will try to create a macro for that purpose and post it. I already have shortcuts for all apps, but there are a gazillion apps + windows for each, etc
It get to be too much to remember + source of conflict with native app shortcuts, for example Scrivener which has a huge number of shortcuts

It dawned on me a simpler solution:
Long press vs Short press of a key.

You can use something like this:

Ie use the same key for both:

  • Short press of the hot key: go back to last app
  • Long: go back to App#3

extremely interesting. I will give it a try. thanks very much !

I wonder if it works with a key combination like Ctrl-M

Yes, just created several that work with keys like WASD. Also works along Karabiner’s Hyper key if you use that.
Will upload an example

1 Like

yery interested ! thank you
I use the Karabiner CAPS key 100 times a day

@Ronald uploading two macros

Macro 1: General example of how it works

In this example, it's triggered using Hyper key X, it just displays a notification with the text "short" if the keypress is short, and displays "long" if the keypress is longer than 0.5seconds.

Macro 2 : App Switcher

This macro, when triggered using Hyper key X, switches between the last 3 apps:

  • A short key press will switch to the Last application
  • A long key press will switch to the Second-to-Last app

Download macros (disabled):
long-vs-short.kmmacros (11.7 KB)

I used some parts from a post but forgot source, let me know if you have any questions


very smart macro. thanks very much
I realized 2 things

  • the if then else + timer action creates the cycle without additional commands, meaning that I after the keypress, I can choose whether to continue or not.
  • the Pause until key includes only the single key portion, not the CAPS or any supplementary second ⇧⌃⌥ ⌘ key.
1 Like

My one action Activate Last Application macro does not make any sense, and I apologize for that. Simply type Cmd-TAB. Thank you @dvandelay for bringing this to my attention. Fortunately, the discussion has evolved to the topic of keypress timing and demultiplication of shortcuts

1 Like

I'm using a note in Apple Notes, just a simple table, helps remember what have I assigned to which key.
So far the simplification has been working well, as there are less keys to remember.

I'm using the first word as a mnemonic aid, so Hyperkey-S runs one of two macros that start with a "S", i.e. Safari and Slack, depending on the time length of the key press.

very smart ! I will try it. Very interesting.

1 Like