From 84d3af0f8d26e06efb01e47a504d510f22caa970 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Thu, 14 Jan 2021 20:56:18 -0500 Subject: Hotkeys (#1236) * Set up hotkey inputs * Improve key display * Add setInput * Add KeyboardShortcutController * Update how display handles hotkeys --- ext/bg/data/options-schema.json | 72 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 71 insertions(+), 1 deletion(-) (limited to 'ext/bg/data') diff --git a/ext/bg/data/options-schema.json b/ext/bg/data/options-schema.json index 5d23df02..44bff10a 100644 --- a/ext/bg/data/options-schema.json +++ b/ext/bg/data/options-schema.json @@ -69,7 +69,8 @@ "dictionaries", "parsing", "anki", - "sentenceParsing" + "sentenceParsing", + "inputs" ], "properties": { "general": { @@ -914,6 +915,75 @@ ] } } + }, + "inputs": { + "type": "object", + "required": [ + "hotkeys" + ], + "properties": { + "hotkeys": { + "type": "array", + "items": { + "type": "object", + "required": [ + "action", + "key", + "modifiers", + "scopes", + "enabled" + ], + "properties": { + "action": { + "type": "string", + "default": "" + }, + "key": { + "type": ["string", "null"], + "default": null + }, + "modifiers": { + "type": "array", + "items": { + "type": "string", + "enum": ["alt", "ctrl", "shift", "meta"], + "default": "alt" + } + }, + "scopes": { + "type": "array", + "items": { + "type": "string", + "enum": ["popup", "search"], + "default": "popup" + }, + "default": ["popup", "search"] + }, + "enabled": { + "type": "boolean", + "default": true + } + } + }, + "default": [ + {"action": "close", "key": "Escape", "modifiers": [], "scopes": ["popup", "search"], "enabled": true}, + {"action": "previousEntry3", "key": "PageUp", "modifiers": ["alt"], "scopes": ["popup", "search"], "enabled": true}, + {"action": "nextEntry3", "key": "PageDown", "modifiers": ["alt"], "scopes": ["popup", "search"], "enabled": true}, + {"action": "lastEntry", "key": "End", "modifiers": ["alt"], "scopes": ["popup", "search"], "enabled": true}, + {"action": "firstEntry", "key": "Home", "modifiers": ["alt"], "scopes": ["popup", "search"], "enabled": true}, + {"action": "previousEntry", "key": "ArrowUp", "modifiers": ["alt"], "scopes": ["popup", "search"], "enabled": true}, + {"action": "nextEntry", "key": "ArrowDown", "modifiers": ["alt"], "scopes": ["popup", "search"], "enabled": true}, + {"action": "historyBackward", "key": "KeyB", "modifiers": ["alt"], "scopes": ["popup", "search"], "enabled": true}, + {"action": "historyForward", "key": "KeyF", "modifiers": ["alt"], "scopes": ["popup", "search"], "enabled": true}, + {"action": "addNoteKanji", "key": "KeyK", "modifiers": ["alt"], "scopes": ["popup", "search"], "enabled": true}, + {"action": "addNoteTermKanji", "key": "KeyE", "modifiers": ["alt"], "scopes": ["popup", "search"], "enabled": true}, + {"action": "addNoteTermKana", "key": "KeyR", "modifiers": ["alt"], "scopes": ["popup", "search"], "enabled": true}, + {"action": "playAudio", "key": "KeyP", "modifiers": ["alt"], "scopes": ["popup", "search"], "enabled": true}, + {"action": "viewNote", "key": "KeyV", "modifiers": ["alt"], "scopes": ["popup", "search"], "enabled": true}, + {"action": "copyHostSelection", "key": "KeyC", "modifiers": ["ctrl"], "scopes": ["popup", "search"], "enabled": true} + ] + } + } } } } -- cgit v1.2.3