sideby 0.19.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -4
- package/ai-tasks.json +28 -0
- package/dist/build.json +1 -1
- package/dist/src/cli/commands.d.ts +22 -1
- package/dist/src/cli/commands.js +815 -21
- package/dist/src/cli/format.d.ts +4 -0
- package/dist/src/cli/format.js +42 -4
- package/dist/src/cli/json-schemas.js +334 -4
- package/dist/src/cli/main.js +159 -13
- package/dist/src/core/accounts.d.ts +6 -0
- package/dist/src/core/accounts.js +12 -0
- package/dist/src/core/autostart.d.ts +11 -0
- package/dist/src/core/autostart.js +32 -5
- package/dist/src/core/browser-profiles.d.ts +23 -2
- package/dist/src/core/browser-profiles.js +148 -37
- package/dist/src/core/claude-settings-file.d.ts +18 -0
- package/dist/src/core/claude-settings-file.js +52 -3
- package/dist/src/core/config.d.ts +5 -0
- package/dist/src/core/config.js +12 -1
- package/dist/src/core/edit-settings.d.ts +7 -0
- package/dist/src/core/edit-settings.js +10 -5
- package/dist/src/core/file-memo.js +26 -4
- package/dist/src/core/history-group.d.ts +28 -0
- package/dist/src/core/history-group.js +47 -0
- package/dist/src/core/history-index.d.ts +145 -0
- package/dist/src/core/history-index.js +447 -0
- package/dist/src/core/history-project.d.ts +13 -0
- package/dist/src/core/history-project.js +87 -0
- package/dist/src/core/history.d.ts +210 -0
- package/dist/src/core/history.js +952 -0
- package/dist/src/core/inbound.d.ts +62 -0
- package/dist/src/core/inbound.js +215 -0
- package/dist/src/core/launch.d.ts +9 -1
- package/dist/src/core/launch.js +58 -24
- package/dist/src/core/live-sessions-copy.d.ts +5 -0
- package/dist/src/core/live-sessions-copy.js +46 -0
- package/dist/src/core/live-sessions-procs.d.ts +89 -0
- package/dist/src/core/live-sessions-procs.js +296 -0
- package/dist/src/core/live-sessions-title.d.ts +28 -0
- package/dist/src/core/live-sessions-title.js +80 -0
- package/dist/src/core/live-sessions.d.ts +68 -0
- package/dist/src/core/live-sessions.js +163 -0
- package/dist/src/core/login-check.d.ts +15 -0
- package/dist/src/core/login-check.js +32 -0
- package/dist/src/core/messages.d.ts +83 -0
- package/dist/src/core/messages.js +433 -0
- package/dist/src/core/project-categories.d.ts +14 -0
- package/dist/src/core/project-categories.js +48 -0
- package/dist/src/core/quota-fetch.d.ts +3 -3
- package/dist/src/core/quota-fetch.js +5 -5
- package/dist/src/core/quota-levels.d.ts +5 -0
- package/dist/src/core/quota-levels.js +5 -0
- package/dist/src/core/remote-control.d.ts +2 -0
- package/dist/src/core/remote-control.js +34 -59
- package/dist/src/core/run-link.d.ts +76 -0
- package/dist/src/core/run-link.js +245 -0
- package/dist/src/core/same-login.d.ts +4 -3
- package/dist/src/core/same-login.js +10 -7
- package/dist/src/core/session-select.d.ts +31 -0
- package/dist/src/core/session-select.js +44 -0
- package/dist/src/families/browser.d.ts +7 -18
- package/dist/src/families/browser.js +19 -8
- package/dist/src/families/claude/deliver.d.ts +2 -0
- package/dist/src/families/claude/deliver.js +43 -0
- package/dist/src/families/claude/history.d.ts +2 -0
- package/dist/src/families/claude/history.js +192 -0
- package/dist/src/families/claude/live-sessions.d.ts +13 -0
- package/dist/src/families/claude/live-sessions.js +117 -0
- package/dist/src/families/claude/messaging.d.ts +69 -0
- package/dist/src/families/claude/messaging.js +165 -0
- package/dist/src/families/claude/mod.d.ts +26 -0
- package/dist/src/families/claude/mod.js +105 -0
- package/dist/src/families/claude/session-files.d.ts +21 -0
- package/dist/src/families/claude/session-files.js +54 -0
- package/dist/src/families/codex/deliver.d.ts +5 -0
- package/dist/src/families/codex/deliver.js +76 -0
- package/dist/src/families/codex/history.d.ts +7 -0
- package/dist/src/families/codex/history.js +174 -0
- package/dist/src/families/codex/index.js +2 -0
- package/dist/src/families/codex/live-sessions.d.ts +12 -0
- package/dist/src/families/codex/live-sessions.js +193 -0
- package/dist/src/families/codex/quota.d.ts +3 -0
- package/dist/src/families/codex/quota.js +123 -0
- package/dist/src/families/codex/rate-limits.js +2 -0
- package/dist/src/families/codex/rollout.js +1 -1
- package/dist/src/families/grok/browser.d.ts +3 -0
- package/dist/src/families/grok/browser.js +5 -0
- package/dist/src/families/grok/history.d.ts +2 -0
- package/dist/src/families/grok/history.js +157 -0
- package/dist/src/families/grok/live-sessions.d.ts +4 -0
- package/dist/src/families/grok/live-sessions.js +80 -0
- package/dist/src/families/grok/login-key.d.ts +14 -0
- package/dist/src/families/grok/login-key.js +37 -0
- package/dist/src/families/history.d.ts +20 -0
- package/dist/src/families/history.js +81 -0
- package/dist/src/families/live-sessions.d.ts +26 -0
- package/dist/src/families/live-sessions.js +9 -0
- package/dist/src/families/login-keys.js +5 -1
- package/dist/src/families/messaging.d.ts +27 -0
- package/dist/src/families/messaging.js +6 -0
- package/dist/src/families/pi/history.d.ts +2 -0
- package/dist/src/families/pi/history.js +124 -0
- package/dist/src/families/pi/live-sessions.d.ts +2 -0
- package/dist/src/families/pi/live-sessions.js +70 -0
- package/dist/src/families/shared/history-text.d.ts +65 -0
- package/dist/src/families/shared/history-text.js +261 -0
- package/dist/src/menubar/hotkey.d.ts +86 -0
- package/dist/src/menubar/hotkey.js +159 -0
- package/dist/src/menubar/script.d.ts +2 -0
- package/dist/src/menubar/script.js +118 -22
- package/dist/src/menubar/snapshot.d.ts +8 -4
- package/dist/src/menubar/snapshot.js +45 -13
- package/dist/src/menubar/strings.d.ts +24 -6
- package/dist/src/menubar/strings.js +24 -6
- package/dist/src/panel/handler.d.ts +69 -0
- package/dist/src/panel/handler.js +686 -15
- package/dist/src/panel/i18n.d.ts +304 -3
- package/dist/src/panel/i18n.js +669 -67
- package/dist/src/panel/orca.d.ts +48 -0
- package/dist/src/panel/orca.js +153 -0
- package/dist/src/panel/page-logic.d.ts +255 -13
- package/dist/src/panel/page-logic.js +483 -1
- package/dist/src/panel/page-script.js +2265 -207
- package/dist/src/panel/page-styles.js +404 -32
- package/dist/src/panel/page.js +1 -0
- package/dist/src/plugins/account-script.js +61 -27
- package/dist/src/plugins/check.js +16 -4
- package/dist/src/plugins/loader.d.ts +8 -1
- package/dist/src/plugins/loader.js +72 -7
- package/dist/src/runtime.d.ts +5 -0
- package/dist/src/runtime.js +27 -5
- package/dist/src/types.d.ts +116 -1
- package/dist/testing/index.d.ts +5 -0
- package/dist/testing/index.js +5 -0
- package/mods/claude/.claude-plugin/plugin.json +7 -0
- package/mods/claude/hooks/hooks.json +1 -0
- package/mods/claude/hooks/register.js +261 -0
- package/package.json +5 -2
- package/schemas/autostart.json +74 -1
- package/schemas/browser-set.json +110 -0
- package/schemas/browser.json +22 -2
- package/schemas/config.json +26 -1
- package/schemas/history-index.json +209 -0
- package/schemas/history-projects.json +133 -0
- package/schemas/history-show.json +275 -0
- package/schemas/history.json +410 -0
- package/schemas/menubar-hotkey.json +139 -0
- package/schemas/menubar-snapshot.json +36 -2
- package/schemas/menubar.json +74 -1
- package/schemas/messages-inbound.json +258 -0
- package/schemas/messages.json +164 -0
- package/schemas/send.json +165 -0
- package/schemas/sessions-copy.json +113 -0
- package/schemas/sessions-open-run.json +97 -0
- package/schemas/sessions.json +237 -0
- package/skills/sideby/SKILL.md +10 -5
- package/skills/sideby/references/accounts.md +11 -0
- package/skills/sideby/references/ai-tasks.md +17 -1
- package/skills/sideby/references/panel.md +6 -4
- package/skills/sideby/references/quota.md +2 -2
- package/skills/sideby/references/sessions.md +79 -0
|
@@ -10,6 +10,8 @@ export const TICK_SECONDS = 5;
|
|
|
10
10
|
export const STALE_SECONDS = 15 * 60;
|
|
11
11
|
/** A snapshot still running after this is ended, so a stuck one cannot stop the refreshes. */
|
|
12
12
|
export const SNAPSHOT_TIMEOUT_SECONDS = 60;
|
|
13
|
+
/** The macOS distributed notification that makes a running item read its snapshot again (`nudgeMenubar`). */
|
|
14
|
+
export const MENUBAR_RELOAD = 'dev.sideby.menubar.reload';
|
|
13
15
|
export const MENUBAR_SCRIPT = String.raw `
|
|
14
16
|
ObjC.import('Cocoa');
|
|
15
17
|
ObjC.import('Carbon');
|
|
@@ -57,10 +59,15 @@ function run(argv) {
|
|
|
57
59
|
var t = sideby(args);
|
|
58
60
|
if (t.launchAndReturnError(null)) actions.push(t);
|
|
59
61
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
+
var forceNext = false;
|
|
63
|
+
function startSnapshot(force) {
|
|
64
|
+
if (task) { if (force) forceNext = true; return; }
|
|
65
|
+
force = force || forceNext;
|
|
66
|
+
forceNext = false;
|
|
62
67
|
$.NSFileManager.defaultManager.createFileAtPathContentsAttributes(out, $(), $());
|
|
63
|
-
|
|
68
|
+
hotkeyReported = hotkeyReport();
|
|
69
|
+
iconReported = iconStable;
|
|
70
|
+
var t = sideby(['menubar', 'snapshot', '--json', '--lang', lang].concat(force ? ['--refresh'] : [], hotkeyReported ? ['--hotkey', hotkeyStatus, '--hotkey-label', hotkeyWant.label] : [], iconReported ? ['--icon', iconReported] : []));
|
|
64
71
|
handle = $.NSFileHandle.fileHandleForWritingAtPath(out);
|
|
65
72
|
t.standardOutput = handle;
|
|
66
73
|
lastStart = now();
|
|
@@ -90,17 +97,53 @@ function run(argv) {
|
|
|
90
97
|
// system-defined event of subtype 6 whose data1 is the key's reference. While the menu is open the key is
|
|
91
98
|
// unregistered, so the press reaches the menu, where a hidden item with the same key closes it.
|
|
92
99
|
var hotkeyWant = null, hotkeyRef = 0, hotkeyBound = false, menuOpen = false, closedAt = 0;
|
|
100
|
+
// Whether the shortcut could be registered ('ok', 'taken', '' when off), and what the last snapshot was told: the
|
|
101
|
+
// status with the shortcut it is about, so a report never lands on a shortcut changed since.
|
|
102
|
+
var hotkeyStatus = '', hotkeyReported = '';
|
|
103
|
+
function hotkeyReport() { return hotkeyStatus && hotkeyWant ? hotkeyStatus + ' ' + hotkeyWant.label : ''; }
|
|
93
104
|
function bindHotkeyFunctions() {
|
|
94
105
|
if (hotkeyBound) return;
|
|
95
106
|
ObjC.bindFunction('GetApplicationEventTarget', ['void *', []]);
|
|
96
107
|
ObjC.bindFunction('RegisterEventHotKey', ['int', ['unsigned int', 'unsigned int', 'unsigned long long', 'void *', 'unsigned int', 'void *']]);
|
|
97
108
|
ObjC.bindFunction('UnregisterEventHotKey', ['int', ['unsigned long long']]);
|
|
98
|
-
|
|
109
|
+
watchKeys();
|
|
110
|
+
hotkeyBound = true;
|
|
111
|
+
}
|
|
112
|
+
// The bridge hands AppKit a JSValue for whatever the handler returns, never the event, so AppKit throws on every
|
|
113
|
+
// system-defined event that passes. The main loop swallows that; a modal loop (an NSAlert) throws it out of
|
|
114
|
+
// runModal. So the monitor is lifted while an alert is up (pauseKeys), and put back after (watchKeys).
|
|
115
|
+
var monitor = null;
|
|
116
|
+
function watchKeys() {
|
|
117
|
+
if (monitor) return;
|
|
118
|
+
monitor = $.NSEvent.addLocalMonitorForEventsMatchingMaskHandler($.NSEventMaskSystemDefined, function (e) {
|
|
99
119
|
// A press queued while the menu was open arrives just after it closes; it meant "close", not "open again".
|
|
100
120
|
if (e.subtype === 6 && hotkeyRef && Number(e.data1) === hotkeyRef && !menuOpen && now() - closedAt > 0.5) openMenu();
|
|
101
121
|
return e;
|
|
102
122
|
});
|
|
103
|
-
|
|
123
|
+
}
|
|
124
|
+
function pauseKeys() {
|
|
125
|
+
if (monitor) { $.NSEvent.removeMonitor(monitor); monitor = null; }
|
|
126
|
+
try { unregisterHotkey(); } catch (e) {}
|
|
127
|
+
}
|
|
128
|
+
function resumeKeys() {
|
|
129
|
+
if (!hotkeyBound) return;
|
|
130
|
+
watchKeys();
|
|
131
|
+
try { registerHotkey(); } catch (e) {}
|
|
132
|
+
}
|
|
133
|
+
// Whether macOS shows the icon now: 'visible', 'hidden' (behind « in a full menu bar, or covered), or '' while the
|
|
134
|
+
// menu bar itself is hidden (a full-screen app), when nothing can be said. The Panel says where it went.
|
|
135
|
+
var iconSeen = '', iconStable = '', iconReported = '';
|
|
136
|
+
function iconNow() {
|
|
137
|
+
if (!$.NSMenu.menuBarVisible) return '';
|
|
138
|
+
var w = item.button.window;
|
|
139
|
+
if (!w || w.isNil()) return '';
|
|
140
|
+
return Number(w.occlusionState) & Number($.NSWindowOcclusionStateVisible) ? 'visible' : 'hidden';
|
|
141
|
+
}
|
|
142
|
+
// Two looks in a row agree before it counts, so a moment of change (a Space switch) is not reported.
|
|
143
|
+
function lookAtIcon() {
|
|
144
|
+
var seen = iconNow();
|
|
145
|
+
if (seen && seen === iconSeen) iconStable = seen;
|
|
146
|
+
iconSeen = seen;
|
|
104
147
|
}
|
|
105
148
|
// Drops the menu from the icon when it shows; at the pointer when the icon is hidden, such as by a full menu bar or
|
|
106
149
|
// under the notch, where clicking it would do nothing.
|
|
@@ -115,7 +158,9 @@ function run(argv) {
|
|
|
115
158
|
if (hotkeyRef || !hotkeyWant) return;
|
|
116
159
|
var buf = $.NSMutableData.dataWithLength(8);
|
|
117
160
|
// EventHotKeyID { OSType signature 'sdby'; UInt32 id 1 } is passed in one register, the id in the high half.
|
|
118
|
-
|
|
161
|
+
// Not 0: another app or macOS holds the key (eventHotKeyExistsErr); the menu and the Panel say so.
|
|
162
|
+
if ($.RegisterEventHotKey(hotkeyWant.keyCode, hotkeyWant.modifiers, 4294967296 + 0x73646279, $.GetApplicationEventTarget(), 0, buf.mutableBytes) !== 0) { hotkeyStatus = 'taken'; return; }
|
|
163
|
+
hotkeyStatus = 'ok';
|
|
119
164
|
// The EventHotKeyRef the call wrote, read back from the buffer as a little-endian number.
|
|
120
165
|
var hex = (ObjC.unwrap(buf.description).match(/0x([0-9a-f]{16})/i) || ['', ''])[1];
|
|
121
166
|
var ref = 0;
|
|
@@ -133,6 +178,7 @@ function run(argv) {
|
|
|
133
178
|
bindHotkeyFunctions();
|
|
134
179
|
unregisterHotkey();
|
|
135
180
|
hotkeyWant = h || null;
|
|
181
|
+
if (!hotkeyWant) hotkeyStatus = '';
|
|
136
182
|
if (!menuOpen) registerHotkey();
|
|
137
183
|
} catch (e) {}
|
|
138
184
|
}
|
|
@@ -225,16 +271,18 @@ function run(argv) {
|
|
|
225
271
|
}
|
|
226
272
|
|
|
227
273
|
var GUTTER = $.NSImage.alloc.initWithSize($.NSMakeSize(14, 14));
|
|
274
|
+
// Where a menu item draws its image and its title (macOS 26 and 27), for the header views that line up with them.
|
|
275
|
+
var HEAD_X = 15, HEAD_TEXT_X = 34;
|
|
228
276
|
|
|
229
277
|
// A quota window as a small rounded bar: a soft track, filled as far as it is used, coloured by level.
|
|
230
278
|
var BAR_W = 44, BAR_H = 5;
|
|
231
|
-
function bar(b) {
|
|
279
|
+
function bar(b, old) {
|
|
232
280
|
var img = $.NSImage.alloc.initWithSize($.NSMakeSize(BAR_W, BAR_H));
|
|
233
281
|
img.lockFocus;
|
|
234
282
|
hex(dark() ? '#1f2c3a' : '#e4edf4').set;
|
|
235
283
|
$.NSBezierPath.bezierPathWithRoundedRectXRadiusYRadius($.NSMakeRect(0, 0, BAR_W, BAR_H), BAR_H / 2, BAR_H / 2).fill;
|
|
236
284
|
if (b.percent > 0) {
|
|
237
|
-
(stale() ? $.NSColor.tertiaryLabelColor : hex(BAR[b.level] || BAR.ok)).set;
|
|
285
|
+
(stale() || old ? $.NSColor.tertiaryLabelColor : hex(BAR[b.level] || BAR.ok)).set;
|
|
238
286
|
var w = Math.max(BAR_H, BAR_W * Math.min(100, b.percent) / 100);
|
|
239
287
|
$.NSBezierPath.bezierPathWithRoundedRectXRadiusYRadius($.NSMakeRect(0, 0, w, BAR_H), BAR_H / 2, BAR_H / 2).fill;
|
|
240
288
|
}
|
|
@@ -294,11 +342,11 @@ function run(argv) {
|
|
|
294
342
|
if (!i && !L.first) return;
|
|
295
343
|
if (!b) { line.appendAttributedString(str('\t\t', plain)); return; }
|
|
296
344
|
line.appendAttributedString(str('\t', plain));
|
|
297
|
-
line.appendAttributedString(bar(b));
|
|
298
|
-
var c = stale() ? color('stale') : b.level === 'ok' ? null : color(b.level);
|
|
345
|
+
line.appendAttributedString(bar(b, r.stale));
|
|
346
|
+
var c = stale() || r.stale ? color('stale') : b.level === 'ok' ? null : color(b.level);
|
|
299
347
|
line.appendAttributedString(str('\t' + b.percent + '%', attrs(c, L.mono, L.para)));
|
|
300
348
|
});
|
|
301
|
-
if (r.reset) line.appendAttributedString(str('\t' + r.reset, dim));
|
|
349
|
+
if (r.stale || r.reset) line.appendAttributedString(str('\t' + (r.stale ? r.note : r.reset), dim));
|
|
302
350
|
return line;
|
|
303
351
|
}
|
|
304
352
|
function accountItem(menu, r, L) {
|
|
@@ -319,17 +367,31 @@ function run(argv) {
|
|
|
319
367
|
}
|
|
320
368
|
return mi;
|
|
321
369
|
}
|
|
322
|
-
// A tool's header: its mark, its name, and the window names over the bar columns.
|
|
370
|
+
// A tool's header: its mark, its name, and the window names over the bar columns. A view, not a title: macOS dims
|
|
371
|
+
// the title of an item that cannot be clicked whatever its colour, which made every tool's name look disabled. The
|
|
372
|
+
// mark and the text sit where an item's image and title do, so the window names stay over their bars.
|
|
323
373
|
function sectionHeader(menu, s, L) {
|
|
324
|
-
var mi = add(menu, s.title, null);
|
|
325
374
|
var line = $.NSMutableAttributedString.alloc.init;
|
|
326
375
|
line.appendAttributedString(str(s.title, attrs($.NSColor.labelColor, L.head, L.headPara)));
|
|
327
376
|
var cols = L.first ? s.columns : [s.columns[1]];
|
|
328
|
-
cols.forEach(function (c) { line.appendAttributedString(str('\t' + (c || ''), attrs($.NSColor.
|
|
377
|
+
cols.forEach(function (c) { line.appendAttributedString(str('\t' + (c || ''), attrs($.NSColor.secondaryLabelColor, L.small, L.headPara))); });
|
|
329
378
|
if (s.rows.some(function (r) { return r.reset; }))
|
|
330
|
-
line.appendAttributedString(str('\t' + snap.labels.resetsHeader, attrs($.NSColor.
|
|
331
|
-
|
|
332
|
-
|
|
379
|
+
line.appendAttributedString(str('\t' + snap.labels.resetsHeader, attrs($.NSColor.secondaryLabelColor, L.small, L.headPara)));
|
|
380
|
+
var W = Math.max(280, L.width), H = 24;
|
|
381
|
+
var v = $.NSView.alloc.initWithFrame($.NSMakeRect(0, 0, W, H));
|
|
382
|
+
v.autoresizingMask = $.NSViewWidthSizable;
|
|
383
|
+
var logo = logoImage(s.logo);
|
|
384
|
+
if (logo) {
|
|
385
|
+
var iv = $.NSImageView.imageViewWithImage(logo);
|
|
386
|
+
iv.frame = $.NSMakeRect(HEAD_X, (H - 14) / 2, 14, 14);
|
|
387
|
+
v.addSubview(iv);
|
|
388
|
+
}
|
|
389
|
+
var text = $.NSTextField.labelWithAttributedString(line);
|
|
390
|
+
text.frame = $.NSMakeRect(HEAD_TEXT_X, (H - 16) / 2, W - HEAD_TEXT_X - 10, 16);
|
|
391
|
+
v.addSubview(text);
|
|
392
|
+
var mi = $.NSMenuItem.alloc.init;
|
|
393
|
+
mi.view = v;
|
|
394
|
+
menu.addItem(mi);
|
|
333
395
|
}
|
|
334
396
|
// The card at the top: Sai, a bold status, and a grey line naming the account the status is about.
|
|
335
397
|
function card(menu, c, L) {
|
|
@@ -386,7 +448,7 @@ function run(argv) {
|
|
|
386
448
|
s.more.rows.forEach(function (r) { accountItem(sub, r, L); });
|
|
387
449
|
var mi = add(menu, s.more.title, null);
|
|
388
450
|
mi.image = GUTTER;
|
|
389
|
-
mi.attributedTitle = str(s.more.title, attrs($.NSColor.
|
|
451
|
+
mi.attributedTitle = str(s.more.title, attrs($.NSColor.labelColor, L.font, null));
|
|
390
452
|
mi.enabled = true;
|
|
391
453
|
mi.submenu = sub;
|
|
392
454
|
}
|
|
@@ -396,6 +458,8 @@ function run(argv) {
|
|
|
396
458
|
withImage(add(menu, snap.labels.refresh, 'refresh:', 0, 'r'), 'arrow.clockwise');
|
|
397
459
|
withImage(add(menu, snap.labels.openPanel, 'openPanel:', 0, 'o'), 'macwindow');
|
|
398
460
|
menu.addItem($.NSMenuItem.separatorItem);
|
|
461
|
+
if (hotkeyStatus === 'taken' && hotkeyWant)
|
|
462
|
+
withImage(add(menu, snap.labels.hotkeyTaken.replace('{key}', hotkeyWant.label), 'openPanel:'), 'keyboard');
|
|
399
463
|
withImage(add(menu, snap.labels.hide, 'hide:'), 'eye.slash');
|
|
400
464
|
} else {
|
|
401
465
|
footer = withImage(add(menu, footerText(), null), 'clock');
|
|
@@ -423,7 +487,9 @@ function run(argv) {
|
|
|
423
487
|
actions = actions.filter(function (t) { return t.running; });
|
|
424
488
|
if (task && task.running && now() - lastStart > TIMEOUT) task.terminate;
|
|
425
489
|
if (task && !task.running) finishSnapshot();
|
|
426
|
-
|
|
490
|
+
lookAtIcon();
|
|
491
|
+
// A shortcut that just registered or failed, and an icon that just showed or went, are told at once.
|
|
492
|
+
if (!task && (forceNext || now() - lastStart >= SNAPSHOT || hotkeyReport() !== hotkeyReported || iconStable !== iconReported)) startSnapshot();
|
|
427
493
|
// The bars are pictures in the colours of the moment; redraw them when light or dark mode changes.
|
|
428
494
|
if (ObjC.unwrap(app.effectiveAppearance.name) !== appearance) build();
|
|
429
495
|
else drawTitle();
|
|
@@ -433,12 +499,40 @@ function run(argv) {
|
|
|
433
499
|
'refresh:': {
|
|
434
500
|
types: ['void', ['id']],
|
|
435
501
|
implementation: function () {
|
|
436
|
-
//
|
|
437
|
-
|
|
502
|
+
// A manual refresh must query the Host, even if an automatic cache read is already running.
|
|
503
|
+
startSnapshot(true);
|
|
504
|
+
},
|
|
505
|
+
},
|
|
506
|
+
// A setting changed (the shortcut): read the snapshot again now, after one that is running, with no restart.
|
|
507
|
+
'reload:': {
|
|
508
|
+
types: ['void', ['id']],
|
|
509
|
+
implementation: function () {
|
|
510
|
+
if (!task) { lastStart = 0; startSnapshot(); } else lastStart = 0;
|
|
438
511
|
},
|
|
439
512
|
},
|
|
440
513
|
'openPanel:': { types: ['void', ['id']], implementation: function () { act(['ui', '--background']); } },
|
|
441
|
-
'hide:': {
|
|
514
|
+
'hide:': {
|
|
515
|
+
types: ['void', ['id']],
|
|
516
|
+
implementation: function () {
|
|
517
|
+
// Hiding also stops it starting at login, so it asks first and says how to bring it back.
|
|
518
|
+
var l = snap ? snap.labels : null;
|
|
519
|
+
if (l && l.hideTitle) {
|
|
520
|
+
var alert = $.NSAlert.alloc.init;
|
|
521
|
+
alert.messageText = l.hideTitle;
|
|
522
|
+
alert.informativeText = l.hideBody;
|
|
523
|
+
alert.addButtonWithTitle(l.hideYes);
|
|
524
|
+
alert.addButtonWithTitle(l.cancel);
|
|
525
|
+
pauseKeys();
|
|
526
|
+
app.activateIgnoringOtherApps(true);
|
|
527
|
+
var answer = alert.runModal;
|
|
528
|
+
app.deactivate;
|
|
529
|
+
resumeKeys();
|
|
530
|
+
// The bridge gives enum constants as strings ("1000") and runModal a number: compare as numbers.
|
|
531
|
+
if (Number(answer) !== Number($.NSAlertFirstButtonReturn)) return;
|
|
532
|
+
}
|
|
533
|
+
act(['menubar', 'off', '--yes']);
|
|
534
|
+
},
|
|
535
|
+
},
|
|
442
536
|
'start:': {
|
|
443
537
|
types: ['void', ['id']],
|
|
444
538
|
implementation: function (sender) {
|
|
@@ -449,6 +543,8 @@ function run(argv) {
|
|
|
449
543
|
},
|
|
450
544
|
});
|
|
451
545
|
var target = $.SidebyMenuBar.alloc.init;
|
|
546
|
+
// Settings changed elsewhere (the Panel, sideby menubar hotkey) arrive as a distributed notification.
|
|
547
|
+
$.NSDistributedNotificationCenter.defaultCenter.addObserverSelectorNameObject(target, 'reload:', $('${MENUBAR_RELOAD}'), $());
|
|
452
548
|
build();
|
|
453
549
|
startSnapshot();
|
|
454
550
|
$.NSTimer.scheduledTimerWithTimeIntervalTargetSelectorUserInfoRepeats(TICK, target, 'tick:', $(), true);
|
|
@@ -16,6 +16,10 @@ export interface MenubarRow {
|
|
|
16
16
|
level: MenubarLevel;
|
|
17
17
|
/** The account `sideby next` would pick in this Family. */
|
|
18
18
|
recommended: boolean;
|
|
19
|
+
/** When the quota was observed, independently of the menu's check time; null without quota. */
|
|
20
|
+
observedAt: string | null;
|
|
21
|
+
/** An old or undated reading, or a failed quota query. */
|
|
22
|
+
stale: boolean;
|
|
19
23
|
/** Hover text: when each window resets, and what a click does. */
|
|
20
24
|
tip: string;
|
|
21
25
|
/**
|
|
@@ -25,7 +29,7 @@ export interface MenubarRow {
|
|
|
25
29
|
bars: [MenubarBar | null, MenubarBar | null] | null;
|
|
26
30
|
/** How long until the fullest window resets, such as `4d 17h`; empty when nothing is used. */
|
|
27
31
|
reset: string;
|
|
28
|
-
/**
|
|
32
|
+
/** A no-quota explanation, or an old-reading warning beside the bars. */
|
|
29
33
|
note: string;
|
|
30
34
|
}
|
|
31
35
|
export interface MenubarSection {
|
|
@@ -74,7 +78,7 @@ export interface MenubarSnapshot {
|
|
|
74
78
|
lang: MenubarLang;
|
|
75
79
|
sections: MenubarSection[];
|
|
76
80
|
/** Footer words; the script fills `{n}` of `updatedMinutes` itself. */
|
|
77
|
-
labels: Pick<MenubarStrings, 'recommended' | 'empty' | 'loading' | 'addAccount' | 'resetsHeader' | 'updatedJustNow' | 'updatedMinutes' | 'refreshing' | 'refreshFailed' | 'refresh' | 'openPanel' | 'hide'>;
|
|
81
|
+
labels: Pick<MenubarStrings, 'recommended' | 'empty' | 'loading' | 'addAccount' | 'resetsHeader' | 'updatedJustNow' | 'updatedMinutes' | 'refreshing' | 'refreshFailed' | 'refresh' | 'openPanel' | 'hide' | 'hideTitle' | 'hideBody' | 'hideYes' | 'cancel' | 'hotkeyTaken'>;
|
|
78
82
|
}
|
|
79
83
|
export interface MenubarFamilyInput {
|
|
80
84
|
id: string;
|
|
@@ -100,8 +104,8 @@ export interface MenubarHotkey {
|
|
|
100
104
|
/** How macOS writes it, such as `⌥⌘S`. */
|
|
101
105
|
label: string;
|
|
102
106
|
}
|
|
103
|
-
export declare const DEFAULT_MENUBAR_HOTKEY = "opt+
|
|
104
|
-
/** Config `menubar.hotkey` (`opt+
|
|
107
|
+
export declare const DEFAULT_MENUBAR_HOTKEY = "opt+x";
|
|
108
|
+
/** Config `menubar.hotkey` (`opt+x`, `off`) as the script registers it; null for `off` or a bad value. */
|
|
105
109
|
export declare function menubarHotkey(value: string | undefined): MenubarHotkey | null;
|
|
106
110
|
/** `2h 5m`, `3d 4h` or `12m` until `at`; at least one minute. */
|
|
107
111
|
export declare function untilText(at: string, now: Date, s: MenubarStrings): string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { openWindows, quotaLevel } from '../core/quota-levels.js';
|
|
1
|
+
import { openWindows, quotaIsStale, quotaLevel } from '../core/quota-levels.js';
|
|
2
2
|
import { fill, MENUBAR_STRINGS } from './strings.js';
|
|
3
|
-
export const DEFAULT_MENUBAR_HOTKEY = 'opt+
|
|
3
|
+
export const DEFAULT_MENUBAR_HOTKEY = 'opt+x';
|
|
4
4
|
// macOS virtual key codes of the ANSI letters and digits (HIToolbox Events.h, kVK_ANSI_*).
|
|
5
5
|
const KEY_CODES = {
|
|
6
6
|
a: 0,
|
|
@@ -47,7 +47,7 @@ const MODIFIERS = [
|
|
|
47
47
|
['shift', 512, '⇧'],
|
|
48
48
|
['cmd', 256, '⌘'],
|
|
49
49
|
];
|
|
50
|
-
/** Config `menubar.hotkey` (`opt+
|
|
50
|
+
/** Config `menubar.hotkey` (`opt+x`, `off`) as the script registers it; null for `off` or a bad value. */
|
|
51
51
|
export function menubarHotkey(value) {
|
|
52
52
|
const parts = (value ?? DEFAULT_MENUBAR_HOTKEY).toLowerCase().split('+');
|
|
53
53
|
const key = parts.pop();
|
|
@@ -78,7 +78,16 @@ export function untilText(at, now, s) {
|
|
|
78
78
|
function row(a, plan, now, s) {
|
|
79
79
|
const recommended = Boolean(plan?.hasQuota && plan.pick === a.ref);
|
|
80
80
|
const startTip = fill(s.startTip, { account: a.ref });
|
|
81
|
-
const base = {
|
|
81
|
+
const base = {
|
|
82
|
+
ref: a.ref,
|
|
83
|
+
label: a.name,
|
|
84
|
+
recommended,
|
|
85
|
+
tip: startTip,
|
|
86
|
+
bars: null,
|
|
87
|
+
reset: '',
|
|
88
|
+
observedAt: null,
|
|
89
|
+
stale: false,
|
|
90
|
+
};
|
|
82
91
|
const noted = (note) => ({ ...base, detail: note, note, level: 'none' });
|
|
83
92
|
if (a.kind === 'api')
|
|
84
93
|
return noted(s.api);
|
|
@@ -87,6 +96,9 @@ function row(a, plan, now, s) {
|
|
|
87
96
|
const open = openWindows(a.quota, now);
|
|
88
97
|
if (a.quota.status !== 'ok' || open === null)
|
|
89
98
|
return noted(s.noData);
|
|
99
|
+
const observedAt = a.quota.observedAt;
|
|
100
|
+
const at = Date.parse(observedAt);
|
|
101
|
+
const stale = quotaIsStale(a.quota, now.getTime());
|
|
90
102
|
const windows = a.quota.windows
|
|
91
103
|
.filter((w) => !w.name)
|
|
92
104
|
.sort((x, y) => (x.windowMinutes ?? 0) - (y.windowMinutes ?? 0));
|
|
@@ -105,17 +117,27 @@ function row(a, plan, now, s) {
|
|
|
105
117
|
const reset = fullest && fullest.usedPercent > 0 ? untilText(fullest.resetsAt, now, s) : '';
|
|
106
118
|
if (reset)
|
|
107
119
|
parts.push(fill(s.resets, { time: reset }));
|
|
120
|
+
if (stale)
|
|
121
|
+
parts.push(s.olderReading);
|
|
108
122
|
const tips = open
|
|
109
123
|
.filter((w) => w.usedPercent > 0)
|
|
110
124
|
.map((w) => fill(s.resetsTip, { label: w.label, time: untilText(w.resetsAt, now, s) }));
|
|
111
125
|
return {
|
|
112
126
|
...base,
|
|
127
|
+
observedAt,
|
|
128
|
+
stale,
|
|
113
129
|
detail: parts.join(s.sep),
|
|
114
130
|
level: quotaLevel(fullest?.usedPercent ?? 0),
|
|
115
|
-
tip: [
|
|
131
|
+
tip: [
|
|
132
|
+
fill(s.observedAt, { time: Number.isFinite(at) ? observedAt : '?' }),
|
|
133
|
+
...(stale ? [s.olderReading] : []),
|
|
134
|
+
...(a.quota.fetchError ? [a.quota.fetchError] : []),
|
|
135
|
+
...tips,
|
|
136
|
+
startTip,
|
|
137
|
+
].join('\n'),
|
|
116
138
|
bars,
|
|
117
139
|
reset,
|
|
118
|
-
note: '',
|
|
140
|
+
note: stale ? s.olderReading : '',
|
|
119
141
|
};
|
|
120
142
|
}
|
|
121
143
|
/** The recommended row first; API key and signed-out rows into `more` while other rows remain to show. */
|
|
@@ -210,22 +232,27 @@ export function menubarSnapshot(families, now, lang, hotkey = null) {
|
|
|
210
232
|
? { account: worst.ref, tool: worst.tool, p: Math.round(worst.value) }
|
|
211
233
|
: {};
|
|
212
234
|
const low = worst !== null && quotaLevel(worst.value) !== 'ok';
|
|
213
|
-
const
|
|
235
|
+
const old = sections.some((s) => s.rows.some((r) => r.stale));
|
|
236
|
+
const { recommended, empty, loading, addAccount, resetsHeader, updatedJustNow, updatedMinutes, refreshing, refreshFailed, refresh, openPanel, hide, hideTitle, hideBody, hideYes, cancel, hotkeyTaken, } = s;
|
|
214
237
|
return {
|
|
215
238
|
schemaVersion: 1,
|
|
216
239
|
title: low ? fill(s.title, values) : '',
|
|
217
|
-
level: worst ? quotaLevel(worst.value) : 'none',
|
|
240
|
+
level: worst && !old ? quotaLevel(worst.value) : 'none',
|
|
218
241
|
tooltip: [
|
|
219
|
-
|
|
242
|
+
old
|
|
243
|
+
? `${s.statusOld} · ${s.detailOld}`
|
|
244
|
+
: worst
|
|
245
|
+
? fill(low ? s.tooltipLow : s.tooltipOk, values)
|
|
246
|
+
: s.tooltipEmpty,
|
|
220
247
|
...(hotkey ? [fill(s.hotkeyTip, { key: hotkey.label })] : []),
|
|
221
248
|
].join('\n'),
|
|
222
249
|
hotkey,
|
|
223
|
-
headline: worst ? fill(low ? s.headlineLow : s.headlineOk, values) : '',
|
|
250
|
+
headline: worst ? (old ? s.statusOld : fill(low ? s.headlineLow : s.headlineOk, values)) : '',
|
|
224
251
|
card: worst
|
|
225
252
|
? {
|
|
226
|
-
status: fill(low ? s.statusLow : s.statusOk, values),
|
|
227
|
-
detail: fill(low ? s.detailLow : s.detailOk, values),
|
|
228
|
-
level: quotaLevel(worst.value),
|
|
253
|
+
status: old ? s.statusOld : fill(low ? s.statusLow : s.statusOk, values),
|
|
254
|
+
detail: old ? s.detailOld : fill(low ? s.detailLow : s.detailOk, values),
|
|
255
|
+
level: old ? 'none' : quotaLevel(worst.value),
|
|
229
256
|
}
|
|
230
257
|
: null,
|
|
231
258
|
updatedAt: now.toISOString(),
|
|
@@ -244,6 +271,11 @@ export function menubarSnapshot(families, now, lang, hotkey = null) {
|
|
|
244
271
|
refresh,
|
|
245
272
|
openPanel,
|
|
246
273
|
hide,
|
|
274
|
+
hideTitle,
|
|
275
|
+
hideBody,
|
|
276
|
+
hideYes,
|
|
277
|
+
cancel,
|
|
278
|
+
hotkeyTaken,
|
|
247
279
|
},
|
|
248
280
|
};
|
|
249
281
|
}
|
|
@@ -8,6 +8,8 @@ export declare const MENUBAR_STRINGS: {
|
|
|
8
8
|
readonly hotkeyTip: 'Press {key} to open this menu from anywhere';
|
|
9
9
|
readonly headlineOk: 'Plenty of quota · highest is {account} ({tool}, {p}%)';
|
|
10
10
|
readonly statusOk: 'Plenty of quota';
|
|
11
|
+
readonly statusOld: 'Quota needs refreshing';
|
|
12
|
+
readonly detailOld: 'Some readings are old · refresh to check';
|
|
11
13
|
readonly statusLow: '{tool} is running low';
|
|
12
14
|
readonly detailOk: 'Highest next account: {account} ({p}% used)';
|
|
13
15
|
readonly detailLow: '{account} is at {p}% · switch tools or wait';
|
|
@@ -17,6 +19,8 @@ export declare const MENUBAR_STRINGS: {
|
|
|
17
19
|
readonly api: 'API key';
|
|
18
20
|
readonly signedOut: 'signed out';
|
|
19
21
|
readonly noData: 'no quota yet';
|
|
22
|
+
readonly olderReading: 'older reading';
|
|
23
|
+
readonly observedAt: 'Quota recorded at {time}';
|
|
20
24
|
readonly window: '{label} {p}%';
|
|
21
25
|
readonly resets: 'resets in {time}';
|
|
22
26
|
readonly resetsTip: '{label} resets in {time}';
|
|
@@ -33,13 +37,18 @@ export declare const MENUBAR_STRINGS: {
|
|
|
33
37
|
readonly empty: 'No accounts yet';
|
|
34
38
|
readonly loading: 'Loading quota…';
|
|
35
39
|
readonly addAccount: 'Add an Account…';
|
|
36
|
-
readonly updatedJustNow: '
|
|
37
|
-
readonly updatedMinutes: '
|
|
40
|
+
readonly updatedJustNow: 'Checked just now';
|
|
41
|
+
readonly updatedMinutes: 'Checked {n} min ago';
|
|
38
42
|
readonly refreshing: 'Refreshing…';
|
|
39
43
|
readonly refreshFailed: 'Could not refresh · showing older numbers';
|
|
40
44
|
readonly refresh: 'Refresh';
|
|
41
45
|
readonly openPanel: 'Open Panel';
|
|
42
|
-
readonly hide: 'Hide from Menu Bar';
|
|
46
|
+
readonly hide: 'Hide from Menu Bar…';
|
|
47
|
+
readonly hideTitle: 'Hide sideby from the menu bar?';
|
|
48
|
+
readonly hideBody: 'It also stops starting at login. To bring it back, turn on “Show quota in the menu bar” in the sideby Panel’s settings, or run: sideby menubar on --yes';
|
|
49
|
+
readonly hideYes: 'Hide';
|
|
50
|
+
readonly cancel: 'Cancel';
|
|
51
|
+
readonly hotkeyTaken: 'macOS did not accept {key} · change it in the Panel';
|
|
43
52
|
};
|
|
44
53
|
readonly zh: {
|
|
45
54
|
readonly title: '{tool} {p}%';
|
|
@@ -49,6 +58,8 @@ export declare const MENUBAR_STRINGS: {
|
|
|
49
58
|
readonly hotkeyTip: '在任何地方按 {key} 即可打开此菜单';
|
|
50
59
|
readonly headlineOk: '额度充足 · 最高为 {account}({tool},已用 {p}%)';
|
|
51
60
|
readonly statusOk: '各工具额度充足';
|
|
61
|
+
readonly statusOld: '额度需要更新';
|
|
62
|
+
readonly detailOld: '部分额度是旧数据 · 请刷新确认';
|
|
52
63
|
readonly statusLow: '{tool} 额度吃紧';
|
|
53
64
|
readonly detailOk: '首选账号中最高:{account}(已用 {p}%)';
|
|
54
65
|
readonly detailLow: '首选 {account} 已用 {p}% · 可换工具或等重置';
|
|
@@ -58,6 +69,8 @@ export declare const MENUBAR_STRINGS: {
|
|
|
58
69
|
readonly api: 'API 密钥';
|
|
59
70
|
readonly signedOut: '未登录';
|
|
60
71
|
readonly noData: '暂无额度';
|
|
72
|
+
readonly olderReading: '旧数据';
|
|
73
|
+
readonly observedAt: '额度记录时间:{time}';
|
|
61
74
|
readonly window: '{label} {p}%';
|
|
62
75
|
readonly resets: '{time}后重置';
|
|
63
76
|
readonly resetsTip: '{label}额度将在 {time}后重置';
|
|
@@ -74,13 +87,18 @@ export declare const MENUBAR_STRINGS: {
|
|
|
74
87
|
readonly empty: '还没有账号';
|
|
75
88
|
readonly loading: '正在读取额度…';
|
|
76
89
|
readonly addAccount: '添加账号…';
|
|
77
|
-
readonly updatedJustNow: '
|
|
78
|
-
readonly updatedMinutes: '{n}
|
|
90
|
+
readonly updatedJustNow: '刚刚检查';
|
|
91
|
+
readonly updatedMinutes: '{n} 分钟前检查';
|
|
79
92
|
readonly refreshing: '正在刷新…';
|
|
80
93
|
readonly refreshFailed: '刷新失败 · 显示的是旧数据';
|
|
81
94
|
readonly refresh: '刷新';
|
|
82
95
|
readonly openPanel: '打开面板';
|
|
83
|
-
readonly hide: '
|
|
96
|
+
readonly hide: '从状态栏隐藏…';
|
|
97
|
+
readonly hideTitle: '要从状态栏隐藏 sideby 吗?';
|
|
98
|
+
readonly hideBody: '隐藏后登录时也不再自动出现。想找回时,在 sideby 面板的设置里打开“在状态栏显示额度”,或运行:sideby menubar on --yes';
|
|
99
|
+
readonly hideYes: '隐藏';
|
|
100
|
+
readonly cancel: '取消';
|
|
101
|
+
readonly hotkeyTaken: 'macOS 没有接受 {key} · 可在面板里更换';
|
|
84
102
|
};
|
|
85
103
|
};
|
|
86
104
|
export type MenubarStrings = Record<keyof (typeof MENUBAR_STRINGS)['en'], string>;
|
|
@@ -8,6 +8,8 @@ export const MENUBAR_STRINGS = {
|
|
|
8
8
|
hotkeyTip: 'Press {key} to open this menu from anywhere',
|
|
9
9
|
headlineOk: 'Plenty of quota · highest is {account} ({tool}, {p}%)',
|
|
10
10
|
statusOk: 'Plenty of quota',
|
|
11
|
+
statusOld: 'Quota needs refreshing',
|
|
12
|
+
detailOld: 'Some readings are old · refresh to check',
|
|
11
13
|
statusLow: '{tool} is running low',
|
|
12
14
|
detailOk: 'Highest next account: {account} ({p}% used)',
|
|
13
15
|
detailLow: '{account} is at {p}% · switch tools or wait',
|
|
@@ -17,6 +19,8 @@ export const MENUBAR_STRINGS = {
|
|
|
17
19
|
api: 'API key',
|
|
18
20
|
signedOut: 'signed out',
|
|
19
21
|
noData: 'no quota yet',
|
|
22
|
+
olderReading: 'older reading',
|
|
23
|
+
observedAt: 'Quota recorded at {time}',
|
|
20
24
|
window: '{label} {p}%',
|
|
21
25
|
resets: 'resets in {time}',
|
|
22
26
|
resetsTip: '{label} resets in {time}',
|
|
@@ -33,13 +37,18 @@ export const MENUBAR_STRINGS = {
|
|
|
33
37
|
empty: 'No accounts yet',
|
|
34
38
|
loading: 'Loading quota…',
|
|
35
39
|
addAccount: 'Add an Account…',
|
|
36
|
-
updatedJustNow: '
|
|
37
|
-
updatedMinutes: '
|
|
40
|
+
updatedJustNow: 'Checked just now',
|
|
41
|
+
updatedMinutes: 'Checked {n} min ago',
|
|
38
42
|
refreshing: 'Refreshing…',
|
|
39
43
|
refreshFailed: 'Could not refresh · showing older numbers',
|
|
40
44
|
refresh: 'Refresh',
|
|
41
45
|
openPanel: 'Open Panel',
|
|
42
|
-
hide: 'Hide from Menu Bar',
|
|
46
|
+
hide: 'Hide from Menu Bar…',
|
|
47
|
+
hideTitle: 'Hide sideby from the menu bar?',
|
|
48
|
+
hideBody: 'It also stops starting at login. To bring it back, turn on “Show quota in the menu bar” in the sideby Panel’s settings, or run: sideby menubar on --yes',
|
|
49
|
+
hideYes: 'Hide',
|
|
50
|
+
cancel: 'Cancel',
|
|
51
|
+
hotkeyTaken: 'macOS did not accept {key} · change it in the Panel',
|
|
43
52
|
},
|
|
44
53
|
zh: {
|
|
45
54
|
title: '{tool} {p}%',
|
|
@@ -49,6 +58,8 @@ export const MENUBAR_STRINGS = {
|
|
|
49
58
|
hotkeyTip: '在任何地方按 {key} 即可打开此菜单',
|
|
50
59
|
headlineOk: '额度充足 · 最高为 {account}({tool},已用 {p}%)',
|
|
51
60
|
statusOk: '各工具额度充足',
|
|
61
|
+
statusOld: '额度需要更新',
|
|
62
|
+
detailOld: '部分额度是旧数据 · 请刷新确认',
|
|
52
63
|
statusLow: '{tool} 额度吃紧',
|
|
53
64
|
detailOk: '首选账号中最高:{account}(已用 {p}%)',
|
|
54
65
|
detailLow: '首选 {account} 已用 {p}% · 可换工具或等重置',
|
|
@@ -58,6 +69,8 @@ export const MENUBAR_STRINGS = {
|
|
|
58
69
|
api: 'API 密钥',
|
|
59
70
|
signedOut: '未登录',
|
|
60
71
|
noData: '暂无额度',
|
|
72
|
+
olderReading: '旧数据',
|
|
73
|
+
observedAt: '额度记录时间:{time}',
|
|
61
74
|
window: '{label} {p}%',
|
|
62
75
|
resets: '{time}后重置',
|
|
63
76
|
resetsTip: '{label}额度将在 {time}后重置',
|
|
@@ -74,13 +87,18 @@ export const MENUBAR_STRINGS = {
|
|
|
74
87
|
empty: '还没有账号',
|
|
75
88
|
loading: '正在读取额度…',
|
|
76
89
|
addAccount: '添加账号…',
|
|
77
|
-
updatedJustNow: '
|
|
78
|
-
updatedMinutes: '{n}
|
|
90
|
+
updatedJustNow: '刚刚检查',
|
|
91
|
+
updatedMinutes: '{n} 分钟前检查',
|
|
79
92
|
refreshing: '正在刷新…',
|
|
80
93
|
refreshFailed: '刷新失败 · 显示的是旧数据',
|
|
81
94
|
refresh: '刷新',
|
|
82
95
|
openPanel: '打开面板',
|
|
83
|
-
hide: '
|
|
96
|
+
hide: '从状态栏隐藏…',
|
|
97
|
+
hideTitle: '要从状态栏隐藏 sideby 吗?',
|
|
98
|
+
hideBody: '隐藏后登录时也不再自动出现。想找回时,在 sideby 面板的设置里打开“在状态栏显示额度”,或运行:sideby menubar on --yes',
|
|
99
|
+
hideYes: '隐藏',
|
|
100
|
+
cancel: '取消',
|
|
101
|
+
hotkeyTaken: 'macOS 没有接受 {key} · 可在面板里更换',
|
|
84
102
|
},
|
|
85
103
|
};
|
|
86
104
|
export function fill(template, values) {
|