Skip to content

Instantly share code, notes, and snippets.

@michaellee
Created March 25, 2022 04:14
Show Gist options
  • Save michaellee/1418f631c59dc6092cce2854fb4e3095 to your computer and use it in GitHub Desktop.
Save michaellee/1418f631c59dc6092cce2854fb4e3095 to your computer and use it in GitHub Desktop.
This is the shortcuts.txt specification document

shortcuts.txt specification

The purpose of this document is to outline the specifications of shortcuts.txt -- a plain-text file used by web applications that indicates what keyboard shortcuts are provided to the user.

Location

In order to support shortcuts.txt, a web application should provide a plain text file located at the root of its application.

Example:

https://pizzamaker3000.com/shortcuts.txt

Syntax

Each shortcuts.txt should be written in TOML (Tom's Obvious Minimal Language). This makes it both easily readable by humans as well as parsable by other applications.

Example shortcuts.txt

# Twitter shortcuts
# Sourced from https://twitter.com/i/keyboard_shortcuts
[[navigation]]
title = "Shortcut help"
shortcut = "?"

[[navigation]]
title = "Next Tweet"
shortcut = "j"

[[navigation]]
title = "Previous Tweet"
shortcut = "k"

[[actions]]
title = "New Tweet"
shortcut = "n"

[[actions]]
title = "Send Tweet"
shortcut = "⌘ + Enter"

Expected JSON:

{
  "navigation": [
    {
      "title": "Shortcut help",
      "shortcut": "?"
    },
    {
      "title": "Next Tweet",
      "shortcut": "j"
    },
    {
      "title": "Previous Tweet",
      "shortcut": "k"
    }
  ],
  "actions": [
    {
      "title": "New Tweet",
      "shortcut": "n"
    },
    {
      "title": "Send Tweet",
      "shortcut": "⌘ + Enter"
    }
  ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment