Skip to content

Instantly share code, notes, and snippets.

@SebastianGrans
Created January 13, 2022 16:58
Show Gist options
  • Save SebastianGrans/cf3c8723f1acdc9f3a301d25c5ca93b2 to your computer and use it in GitHub Desktop.
Save SebastianGrans/cf3c8723f1acdc9f3a301d25c5ca93b2 to your computer and use it in GitHub Desktop.
Remapping the media keys to VS Code debug keys on MacOS

Remapping the media keys to VS Code debug keys on MacOS

I wanted to directly use the media keys to start debugging and stepping when working inside VS Code. This can be achieved using the app BetterTouchTool.

In BetterTouchTool I create a special

Essentially I create the following mapping:

  • ⏯ → F5 (Continue / Pause)
  • ⏩ → F10 (Step Over)
  • ⏪ → F11 (Step Into)
  • ⇧⏪ → ⇧F11 (Step Out)
  • ⌘⏯ → ⇧⌘F5 (Restart)
  • ⇧⏯ → ⇧F5 (Stop)

I'd still like to be able to control the music which is achieved by using the function modifier. I.e. fn⏯ will play/pause. This corresponds to the mapping:

  • F7 → ⏪
  • F8 → ⏯
  • F9 → ⏩

Installation

In BetterTouchTool, create a new keyboard shortcut pane just for VS Code and then copy and paste the json data from the file below.

[
{
"BTTGestureNotes" : "⏯ Start debugging \/ Continue",
"BTTTriggerType" : 0,
"BTTTriggerClass" : "BTTTriggerTypeKeyboardShortcut",
"BTTPredefinedActionType" : -1,
"BTTPredefinedActionName" : "No Action",
"BTTLayoutIndependentActionChar" : "F5",
"BTTAutoAdaptActionToKeyboardLayout" : true,
"BTTShortcutToSend" : "96",
"BTTAdditionalConfiguration" : "0",
"BTTEnabled2" : 1,
"BTTKeyboardShortcutScope" : 0,
"BTTKeyboardShortcutKeyboardType" : 2302,
"BTTRepeatDelay" : 0,
"BTTUUID" : "75D7D405-0DCE-4B55-99CD-73D793CBEC82",
"BTTTriggerOnDown" : 0,
"BTTNotesInsteadOfDescription" : 0,
"BTTLayoutIndependentChar" : "",
"BTTEnabled" : 1,
"BTTModifierMode" : 0,
"BTTShortcutKeyCode" : 1016,
"BTTShortcutModifierKeys" : 0,
"BTTOrder" : 0,
"BTTDisplayOrder" : 0,
"BTTAutoAdaptToKeyboardLayout" : 0
},
{
"BTTGestureNotes" : "⏩ steps over",
"BTTTriggerType" : 0,
"BTTTriggerClass" : "BTTTriggerTypeKeyboardShortcut",
"BTTPredefinedActionType" : -1,
"BTTPredefinedActionName" : "No Action",
"BTTLayoutIndependentActionChar" : "F10",
"BTTAutoAdaptActionToKeyboardLayout" : true,
"BTTShortcutToSend" : "109",
"BTTAdditionalConfiguration" : "0",
"BTTEnabled2" : 1,
"BTTKeyboardShortcutKeyboardType" : 2302,
"BTTRepeatDelay" : 0,
"BTTUUID" : "72EEF438-5F57-4EB2-BF59-47B618F3363D",
"BTTTriggerOnDown" : 1,
"BTTNotesInsteadOfDescription" : 0,
"BTTLayoutIndependentChar" : "",
"BTTEnabled" : 1,
"BTTModifierMode" : 0,
"BTTShortcutKeyCode" : 1019,
"BTTShortcutModifierKeys" : 0,
"BTTOrder" : 1,
"BTTDisplayOrder" : 0,
"BTTAutoAdaptToKeyboardLayout" : 0
},
{
"BTTGestureNotes" : "⏪ steps into",
"BTTTriggerType" : 0,
"BTTTriggerClass" : "BTTTriggerTypeKeyboardShortcut",
"BTTPredefinedActionType" : -1,
"BTTPredefinedActionName" : "No Action",
"BTTLayoutIndependentActionChar" : "F11",
"BTTAutoAdaptActionToKeyboardLayout" : true,
"BTTShortcutToSend" : "103",
"BTTAdditionalConfiguration" : "0",
"BTTEnabled2" : 1,
"BTTKeyboardShortcutKeyboardType" : 2302,
"BTTRepeatDelay" : 0,
"BTTUUID" : "CF865696-355D-4E16-B6D4-76697DF58715",
"BTTTriggerOnDown" : 1,
"BTTNotesInsteadOfDescription" : 0,
"BTTLayoutIndependentChar" : "",
"BTTEnabled" : 1,
"BTTModifierMode" : 0,
"BTTShortcutKeyCode" : 1020,
"BTTShortcutModifierKeys" : 0,
"BTTOrder" : 2,
"BTTDisplayOrder" : 0,
"BTTAutoAdaptToKeyboardLayout" : 0
},
{
"BTTGestureNotes" : "⇧⏪ steps out",
"BTTTriggerType" : 0,
"BTTTriggerClass" : "BTTTriggerTypeKeyboardShortcut",
"BTTPredefinedActionType" : -1,
"BTTPredefinedActionName" : "No Action",
"BTTLayoutIndependentActionChar" : "F11",
"BTTAutoAdaptActionToKeyboardLayout" : true,
"BTTShortcutToSend" : "56,103",
"BTTAdditionalConfiguration" : "131072",
"BTTEnabled2" : 1,
"BTTKeyboardShortcutKeyboardType" : 2302,
"BTTRepeatDelay" : 0,
"BTTUUID" : "1F0C5282-0113-4FBE-8D02-42214C1633C8",
"BTTTriggerOnDown" : 1,
"BTTNotesInsteadOfDescription" : 0,
"BTTLayoutIndependentChar" : "",
"BTTEnabled" : 1,
"BTTModifierMode" : 0,
"BTTShortcutKeyCode" : 1020,
"BTTShortcutModifierKeys" : 131072,
"BTTOrder" : 3,
"BTTDisplayOrder" : 0,
"BTTAutoAdaptToKeyboardLayout" : 0
},
{
"BTTGestureNotes" : "⇧⏯ stops execution",
"BTTTriggerType" : 0,
"BTTTriggerClass" : "BTTTriggerTypeKeyboardShortcut",
"BTTPredefinedActionType" : -1,
"BTTPredefinedActionName" : "No Action",
"BTTLayoutIndependentActionChar" : "F5",
"BTTAutoAdaptActionToKeyboardLayout" : true,
"BTTShortcutToSend" : "56,96",
"BTTAdditionalConfiguration" : "131072",
"BTTEnabled2" : 1,
"BTTKeyboardShortcutKeyboardType" : 2302,
"BTTRepeatDelay" : 0,
"BTTUUID" : "5AB478A5-8F16-4012-916C-FBEDA703C640",
"BTTTriggerOnDown" : 1,
"BTTNotesInsteadOfDescription" : 0,
"BTTLayoutIndependentChar" : "",
"BTTEnabled" : 1,
"BTTModifierMode" : 0,
"BTTShortcutKeyCode" : 1016,
"BTTShortcutModifierKeys" : 131072,
"BTTOrder" : 4,
"BTTDisplayOrder" : 0,
"BTTAutoAdaptToKeyboardLayout" : 0
},
{
"BTTGestureNotes" : "⌘⏯ restarts execution",
"BTTTriggerType" : 0,
"BTTTriggerClass" : "BTTTriggerTypeKeyboardShortcut",
"BTTPredefinedActionType" : -1,
"BTTPredefinedActionName" : "No Action",
"BTTLayoutIndependentActionChar" : "F5",
"BTTAutoAdaptActionToKeyboardLayout" : true,
"BTTShortcutToSend" : "56,55,96",
"BTTAdditionalConfiguration" : "1048576",
"BTTEnabled2" : 1,
"BTTKeyboardShortcutKeyboardType" : 2302,
"BTTRepeatDelay" : 0,
"BTTUUID" : "F1C0613A-FF9F-4578-B1DA-B49C8CB267C5",
"BTTTriggerOnDown" : 1,
"BTTNotesInsteadOfDescription" : 0,
"BTTLayoutIndependentChar" : "",
"BTTEnabled" : 1,
"BTTModifierMode" : 0,
"BTTShortcutKeyCode" : 1016,
"BTTShortcutModifierKeys" : 1048576,
"BTTOrder" : 5,
"BTTDisplayOrder" : 0,
"BTTAutoAdaptToKeyboardLayout" : 0
},
{
"BTTGestureNotes" : "Fn ⏪ (F7) is Previous",
"BTTTriggerType" : 0,
"BTTTriggerClass" : "BTTTriggerTypeKeyboardShortcut",
"BTTPredefinedActionType" : 26,
"BTTPredefinedActionName" : "Previous",
"BTTAdditionalConfiguration" : "8388608",
"BTTEnabled2" : 1,
"BTTKeyboardShortcutScope" : 0,
"BTTKeyboardShortcutKeyboardType" : 2302,
"BTTRepeatDelay" : 0,
"BTTUUID" : "E54910AC-97C1-4D47-A7B6-CBB46D187D1A",
"BTTTriggerOnDown" : 1,
"BTTNotesInsteadOfDescription" : 0,
"BTTLayoutIndependentChar" : "F7",
"BTTEnabled" : 1,
"BTTModifierMode" : 0,
"BTTShortcutKeyCode" : 98,
"BTTShortcutModifierKeys" : 8388608,
"BTTOrder" : 6,
"BTTDisplayOrder" : 0,
"BTTAutoAdaptToKeyboardLayout" : 0
},
{
"BTTGestureNotes" : "Fn ⏯ (F8) is Play\/Pause",
"BTTTriggerType" : 0,
"BTTTriggerClass" : "BTTTriggerTypeKeyboardShortcut",
"BTTPredefinedActionType" : 23,
"BTTPredefinedActionName" : "Play\/Pause",
"BTTAdditionalConfiguration" : "8388608",
"BTTEnabled2" : 1,
"BTTKeyboardShortcutScope" : 0,
"BTTKeyboardShortcutKeyboardType" : 2302,
"BTTRepeatDelay" : 0,
"BTTUUID" : "BAB57BFB-47E1-47B9-A513-5078E800B98B",
"BTTTriggerOnDown" : 1,
"BTTNotesInsteadOfDescription" : 0,
"BTTLayoutIndependentChar" : "F8",
"BTTEnabled" : 1,
"BTTModifierMode" : 0,
"BTTShortcutKeyCode" : 100,
"BTTShortcutModifierKeys" : 8388608,
"BTTOrder" : 7,
"BTTDisplayOrder" : 0,
"BTTAutoAdaptToKeyboardLayout" : 0
},
{
"BTTGestureNotes" : "Fn ⏩ (F9) is Next",
"BTTTriggerType" : 0,
"BTTTriggerClass" : "BTTTriggerTypeKeyboardShortcut",
"BTTPredefinedActionType" : 27,
"BTTPredefinedActionName" : "Next",
"BTTAdditionalConfiguration" : "8388608",
"BTTEnabled2" : 1,
"BTTKeyboardShortcutScope" : 0,
"BTTKeyboardShortcutKeyboardType" : 2302,
"BTTRepeatDelay" : 0,
"BTTUUID" : "88891F9D-1EA8-4B61-B0C2-381542DDC823",
"BTTTriggerOnDown" : 1,
"BTTNotesInsteadOfDescription" : 0,
"BTTLayoutIndependentChar" : "F9",
"BTTEnabled" : 1,
"BTTModifierMode" : 0,
"BTTShortcutKeyCode" : 101,
"BTTShortcutModifierKeys" : 8388608,
"BTTOrder" : 8,
"BTTDisplayOrder" : 0,
"BTTAutoAdaptToKeyboardLayout" : 0
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment