Action
List Action Keyboard Shortcuts
Last update
about 2 months ago
- Unlisted
Query all configured Action keyboard shortcuts and output them as a sorted, formatted Markdown list.
Steps
-
script
// Drafts Action: List Action Keyboard Shortcuts (Markdown) function getAllActions() { let all = []; ActionGroup.getAll().forEach((grp) => (all = all.concat(grp.actions))); return all; } function parseShortcut(action) { try { const raw = decodeURIComponent(action.installURL.replace("drafts://action?data=", "")); const data = JSON.parse(raw); if (!data.keyCommand) return ""; const kc = data.keyCommand; const parts = []; // Apple style glyphs if (kc.commandKey) parts.push("⌘"); if (kc.optionKey) parts.push("⌥"); if (kc.controlKey) parts.push("⌃"); if (kc.shiftKey) parts.push("⇧"); if (kc.input && kc.input.length > 0) { switch (kc.input) { case "#LEFT": parts.push("←"); break; case "#RIGHT": parts.push("→"); break; case "#UP": parts.push("↑"); break; case "#DOWN": parts.push("↓"); break; case "#TAB": parts.push("⇥"); break; case "#ESC": parts.push("⎋"); break; default: parts.push(kc.input); } } return parts.join(""); } catch (e) { return ""; } } const items = []; getAllActions().forEach((act) => { const shortcut = parseShortcut(act); if (shortcut) { items.push({ title: act.name, keys: shortcut }); } }); // sort by title (case-insensitive) items.sort((a, b) => a.title.toLowerCase().localeCompare(b.title.toLowerCase())); const lines = items.map((itm) => `- *${itm.title.replace(/([*_])/g, "\\$1")}* - \`${itm.keys}\``); const output = lines.join("\n"); // copy to clipboard & pass to template tag app.setClipboard(output); draft.setTemplateTag("keylist", output); -
createDraft
template # Action Keyboard Shortcuts [[keylist]]
tags folder inbox
flagged false
openInEditor true
Options
-
After Success Nothing Notification Info Log Level Error
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.