-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshortcuts.html
More file actions
262 lines (255 loc) · 11 KB
/
Copy pathshortcuts.html
File metadata and controls
262 lines (255 loc) · 11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
<!doctype html>
<html lang="en" data-theme="light">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Shortcuts - Degoog docs</title>
<script>
(function () {
try {
var t = localStorage.getItem("ade:theme");
if (t !== "light" && t !== "dark") {
t = window.matchMedia("(prefers-color-scheme: dark)").matches
? "dark"
: "light";
}
document.documentElement.setAttribute("data-theme", t);
} catch (e) {}
})();
</script>
<link
rel="icon"
href="https://github.com/fccview/degoog/raw/main/src/public/images/degoog-logo.png"
/>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css"
/>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"
/>
<link rel="stylesheet" href="style.css?cache=burstthefucker" />
</head>
<body>
<div class="degoog-docs-layout">
<header class="degoog-docs-mobile-header">
<button
id="degoog-docs-burger"
type="button"
class="degoog-docs-btn degoog-docs-btn-burger"
aria-label="Open navigation menu"
>
<i class="fa-solid fa-bars"></i>
</button>
<span class="degoog-docs-mobile-title">Degoog Docs</span>
</header>
<div class="degoog-docs-content">
<aside class="degoog-docs-sidebar">
<div class="degoog-docs-sidebar-brand">
<img
src="https://github.com/fccview/degoog/raw/main/src/public/images/degoog-logo.png"
alt="degoog logo"
class="degoog-docs-brand-img"
onerror="this.style.display = 'none'"
/>
<a href="index.html" class="degoog-docs-brand-name">Degoog Docs</a>
</div>
<div class="degoog-docs-sidebar-search">
<div class="doc-search-wrap">
<input
type="search"
id="doc-search-input"
class="degoog-docs-input doc-search"
placeholder="Search docs..."
autocomplete="off"
/>
<button
type="button"
class="doc-search-clear degoog-docs-btn"
aria-label="Clear search"
style="display: none"
>
Clear
</button>
<span class="doc-search-count"></span>
</div>
</div>
<nav class="degoog-docs-nav" aria-label="Documentation">
<a href="index.html" class="degoog-docs-nav-item"
><i class="fa-solid fa-book-open fa-lg"></i
><span class="degoog-docs-nav-item-name">Overview</span></a
>
<a href="plugins.html" class="degoog-docs-nav-item"
><i class="fa-solid fa-puzzle-piece fa-lg"></i
><span class="degoog-docs-nav-item-name"> Plugins</span></a
>
<a href="shortcuts.html" class="degoog-docs-nav-item degoog-docs-nav-item--active"
><i class="fa-solid fa-arrow-down-a-z fa-lg"></i></i
><span class="degoog-docs-nav-item-name"> Shortcuts</span></a
>
<a href="themes.html" class="degoog-docs-nav-item"
><i class="fa-solid fa-palette fa-lg"></i
><span class="degoog-docs-nav-item-name"> Themes</span></a
>
<a href="engines.html" class="degoog-docs-nav-item"
><i class="fa-solid fa-bolt fa-lg"></i
><span class="degoog-docs-nav-item-name"> Search engines</span></a
>
<a href="autocomplete.html" class="degoog-docs-nav-item"
><i class="fa-solid fa-keyboard fa-lg"></i
><span class="degoog-docs-nav-item-name"> Autocomplete</span></a
>
<a href="transports.html" class="degoog-docs-nav-item"
><i class="fa-solid fa-network-wired fa-lg"></i
><span class="degoog-docs-nav-item-name"> Transports</span></a
>
<a href="store.html" class="degoog-docs-nav-item"
><i class="fa-solid fa-store fa-lg"></i
><span class="degoog-docs-nav-item-name"> Store</span></a
>
<a href="aliases.html" class="degoog-docs-nav-item"
><i class="fa-solid fa-link fa-lg"></i
><span class="degoog-docs-nav-item-name"> Aliases</span></a
>
<a href="env.html" class="degoog-docs-nav-item"
><i class="fa-solid fa-lock fa-lg"></i
><span class="degoog-docs-nav-item-name">ENV Variables</span></a
>
<a href="styling.html" class="degoog-docs-nav-item"
><i class="fa-solid fa-swatchbook fa-lg"></i
><span class="degoog-docs-nav-item-name"> Styling</span></a
>
<a href="translations.html" class="degoog-docs-nav-item"
><i class="fa-solid fa-language fa-lg"></i
><span class="degoog-docs-nav-item-name"> Translations</span></a
>
<a href="api.html" class="degoog-docs-nav-item"
><i class="fa-solid fa-code fa-lg"></i
><span class="degoog-docs-nav-item-name"> API</span></a
>
</nav>
</aside>
<main class="degoog-docs-main">
<h1>Shortcuts</h1>
<p>
Shortcuts are keyboard-triggered extension modules. The core app
keeps <code>/</code> for search focus; the rest of the default
shortcuts are installed through the extension store so they can be
updated, removed, and distributed like other extension types.
</p>
<h2>Where shortcuts live</h2>
<p>
Local shortcuts live in <code>data/shortcuts</code>. A local file
can be a flat JavaScript file such as
<code>data/shortcuts/my-action-shortcut.js</code>, or a store
package can install a shortcut directory under the same root.
Store repositories declare shortcuts with a top-level
<code>shortcuts</code> array in <code>package.json</code>.
</p>
<pre><code>{
"shortcuts": [
{
"name": "Next tab",
"description": "Switch to the next visible results tab.",
"path": "shortcuts/next-tab",
"version": "1.0.0"
}
]
}</code></pre>
<h2>Shortcut module shape</h2>
<p>
A shortcut module exports an object with a name, optional
description, a default binding, and a <code>run</code> function.
The <code>run</code> function receives a browser-side context for
DOM manipulation.
</p>
<pre><code>export default {
name: "Focus first result",
description: "Move focus to the first visible result link.",
defaultBinding: { key: "j", alt: true },
run({ document }) {
document.querySelector("#results-list a.result-title")?.focus();
},
};</code></pre>
<p>
Numeric shortcuts use <code>kind: "numeric"</code>. Their binding
stores only modifiers, and the engine registers one binding per
digit, mapping the recorded modifier plus <code>1</code> through
<code>9</code> to the same shortcut. The digit that was pressed is
read from <code>event.key</code> inside <code>run</code>, so a
single numeric shortcut covers all nine keys. The trigger range is
fixed to <code>1</code>–<code>9</code>.
</p>
<pre><code>export default {
name: "Switch tab by number",
kind: "numeric",
defaultBinding: { alt: true },
run({ document, event }) {
const n = Number(event.key);
document.querySelectorAll(".results-tab")[n - 1]?.click();
},
};</code></pre>
<h2>Bindings and settings</h2>
<p>
User-selected bindings are stored in <code>plugin-settings.json</code>
under the <code>shortcuts</code> settings id. The stored values are
only the mapping overrides; shortcut source code remains in
<code>data/shortcuts</code> or in installed store extension folders.
</p>
<p>
To rebind a shortcut, click its recorder button in the Shortcuts
tab and press the new combination. For numeric shortcuts the
recorder prompts for a modifier plus any key, and only the
modifiers are saved. Press <code>Escape</code> while recording to
cancel, and use the reset action to return a shortcut to its
default binding.
</p>
<p>
Modifier labels are rendered per platform: macOS shows the standard
symbols (<code>⌘</code>, <code>⌥</code>,
<code>⌃</code>, <code>⇧</code>), Windows shows
<code>Win</code> for the meta key, and Linux shows
<code>Super</code>. The extension store catalog also renders a
shortcut's default binding as CSS keycaps in place of a screenshot.
</p>
<h2>Creating shortcuts in the UI</h2>
<p>
Settings includes a Shortcuts tab with an add shortcut action. The
editor scaffolds the module syntax, supports syntax highlighting,
and handles Tab and Shift+Tab indentation inside the code area.
Saving writes a local editable shortcut file to
<code>data/shortcuts</code> and reloads the shortcut registry.
</p>
<h2>Enabling and disabling shortcuts</h2>
<p>
Each store-installed or locally created shortcut has an on/off
toggle on its card in the Shortcuts tab. Toggling writes the
<code>disabled</code> setting for that shortcut, the same value
exposed on the Extensions tab, so the two stay in sync. A disabled
shortcut is skipped when the page registers shortcuts, so it stops
firing on the next page load. The built-in <code>/</code> search
focus action is part of the core app rather than an extension, so
it can be rebound or reset but not disabled.
</p>
<h2>Deleting shortcuts</h2>
<p>
The Shortcuts tab can delete editable local shortcut files created
in <code>data/shortcuts</code>. Store-installed shortcuts are managed
through the store install or uninstall flow, so deleting from the
Shortcuts tab does not remove store package files.
</p>
</main>
</div>
<div id="degoog-docs-backdrop" class="degoog-docs-backdrop"></div>
</div>
<script
src="https://code.jquery.com/jquery-4.0.0.min.js"
crossorigin="anonymous"
></script>
<script src="docs.js"></script>
<script src="docs-ui.js"></script>
</body>
</html>