Fauxpourri

Keyboard shortcuts

I've found keyboard shortcuts really useful. Not quite a poweruser but I end up learning a few when I get a new tool.

Karabiner-elements is just excellent when it comes to Mac keyboard shortcut customization. It's open-sourced and has a great community, however it's a bit of a challenge trying to find a complex-modification (as it's called) for the thing you want.

For instance, I wanted ESC to close a chat in the Signal desktop app. Needless to say, I searched on the Signal community if there's a feature request and found it. It was tersely closed with a link to the keyboard shortcuts page. While ⌘ Shift C makes sense, I found myself agreeing with the requestor that ESC makes sense too. In fact, ESC works in the WhatsApp desktop app!

I searched through Karabiner-Elements complex modifications without success. Then I asked ChatGPT to create one for me (I assert I could have done it myself, of course, pffft) and it did a pretty good job of it.

{
  "title": "Escape → ⌘⇧C only in Signal",
  "rules": [
    {
      "description": "Map Escape to Command+Shift+C in Signal Desktop",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "escape"
          },
          "to": [
            {
              "key_code": "c",
              "modifiers": ["left_command", "left_shift"]
            }
          ],
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "^org\\.whispersystems\\.signal-desktop$"
              ]
            }
          ]
        }
      ]
    }
  ]
}

It got the bundle ID wrong the first time but helped me get it with osascript -e 'id of app "Signal"'. Et voila! It works! Hit ESC to close a chat.


Published .
Last edited 7 months, 1 week ago.

#karabiner #karabiner-elements #keyboard-shortcuts #mac