MacOS – How to assign tilde to command-tab

keyboardmacosshortcut

Is there any way to assign the tilde character '~' as system-wide shortcut for Command-Tab to switch back and forth between two recent open apps?

Currently I assigned tilde to my iterm as system-wide hotkey however, I can't figure out how to do so in System Preferences.

Best Answer

You can do this with Karabiner with a private.xml such as this:

<?xml version="1.0"?>
<root>
  <item>
    <name>~ to ⌘⇥</name>
    <identifier>private.tildetocommandtab</identifier>
    <autogen>
      __KeyToKey__
      KeyCode::BACKQUOTE, VK_SHIFT | ModifierFlag::NONE,
      KeyCode::TAB | ModifierFlag::COMMAND_L
    </autogen>
  </item>
</root>

This will effectively replace command with shift and tab with tilde, so that holding shift and pressing tilde twice will switch to the third app rather than back to the first.