solomkinmv / hotkys

Collection of useful shortcuts for different applications
https://hotkys.com/
MIT License
7 stars 4 forks source link
keyboard-shortcuts

Hotkys

Website and Raycast extension that allows you to find shortcuts for your app.

The Raycast extension adds additional automation features:

  1. Find shortcuts for the frontmost application
  2. Run shortcuts by selecting from the list
  3. Copy bundle id for the frontmost application

Contributing shortcuts

Shortcut definitions are stored as JSON files in shortcuts-disco-site/shortcuts-data. Each application has one file.

To add shortcuts for a new application or web app, create a new JSON file, like example-app.json. To understand the required structure, take a look at this basic example with a subset of Safari's shortcuts:

{
  "$schema": "schema/shortcut.schema.json",
  "bundleId": "com.apple.Safari",
  "name": "Safari",
  "slug": "safari",
  "keymaps": [
    {
      "title": "Default",
      "sections": [
        {
          "title": "Bookmarks",
          "shortcuts": [
            {
              "title": "Open Bookmarks Manager",
              "key": "opt+cmd+b"
            }
          ]
        },
        {
          "title": "Other",
           "shortcuts": [
            {
              "title": "Modify the toolbar",
              "comment": "Hold Cmd while dragging a toolbar element"
            },
            {
              "title": "Print the current webpage",
              "key": "cmd+p"
            }
          ]
        }
      ]
    }
  ]
}

The structure contains the following information:

Application information

Shortcut information

The TypeScript interfaces for the keyboard definition model with all options can be found here.

JSON schema

The schema in the first line ("$schema": "schema/shortcut.schema.json") will help with validating the JSON structure.

Using it, an editor like VS Code will automatically show warnings if the JSON structure is invalid. It doesn't provide all the required validation, but dramatically simplifies the whole process.

Fixing the JSON format

Use the prettify script to format all the JSON files and fix the order of key modifiers.

Go to shortcuts-disco-site folder and run:

npm run prettify