Skip to content

Instantly share code, notes, and snippets.

@extratone
Created September 22, 2025 10:23
Show Gist options
  • Select an option

  • Save extratone/879bbbbb13379043b8325580dc8bcea4 to your computer and use it in GitHub Desktop.

Select an option

Save extratone/879bbbbb13379043b8325580dc8bcea4 to your computer and use it in GitHub Desktop.
Drafts Action Script to query, sort, and reformat all configured Action keyboard shortcuts as a markdown list.
// 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);
@castleappsmom-maker
Copy link

The Y999 game download APK is a real-money gaming app offering high earning potential, instant withdrawals, and multiple game modes. With secure transactions, referral bonuses, and daily rewards, users in Pakistan can earn cash using Android phones.

@wellhealthor
Copy link

Love seeing these code snippets and the collaborative feedback here — it’s great how developers break down ideas and help one another improve solutions. Discussions like this make the coding community stronger and more supportive. I also share simple wellness and lifestyle tips that help people stay balanced and focused while coding: wellhealthorg.com. Appreciate the insight!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment