Tray icon with live transfer progress and tabs menu
- AppTray: template menu-bar icon (22pt, adapts to light/dark). While transfers run it swaps to pre-rendered frames — faded arrows + a fill bar showing aggregate doneBytes/totalBytes of the queue (nearest 5%, throttled 500ms); back to the glyph when idle. No runtime image encoding. - Menu: one entry per tab (checkmark on the active one) with live per-tab transfer count and percentage (jobs mapped via session ids), an overall progress row while transferring, Show <app>, Quit. Selecting a tab activates the window and switches to it. - First use of webview->bun messages: PanelsService pushes workspacesSync (tab names, sessions, active id) via a new ready-gated send proxy; verified end-to-end in the running app. - engine.aggregateProgress(): totals + per-session breakdown over non-terminal jobs (unit-verified idle/mid-transfer/idle). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
+6
-1
@@ -67,8 +67,13 @@ export class App {
|
||||
});
|
||||
}
|
||||
|
||||
/** Native application-menu actions forwarded from the bun process. */
|
||||
/** Native application-menu / tray actions forwarded from the bun process. */
|
||||
private handleMenuAction(action: string): void {
|
||||
if (action.startsWith('activate-tab:')) {
|
||||
const id = Number(action.slice('activate-tab:'.length));
|
||||
if (Number.isFinite(id)) this.panels.setActiveWorkspace(id);
|
||||
return;
|
||||
}
|
||||
if (action.startsWith('connect:')) {
|
||||
const id = action.slice('connect:'.length);
|
||||
const connection = this.connections.connections().find((c) => c.id === id);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Injectable, computed, signal, type WritableSignal } from '@angular/core';
|
||||
import { Injectable, computed, effect, signal, type WritableSignal } from '@angular/core';
|
||||
import type { ConnectionConfig, FileEntry, SavedConnection } from '@shared/types';
|
||||
import { RpcService } from './rpc.service';
|
||||
import { ToastService } from './toast.service';
|
||||
@@ -180,6 +180,21 @@ export class PanelsService {
|
||||
) {
|
||||
this.newWorkspace();
|
||||
|
||||
// keep the bun-side tray informed about tabs (names, sessions, active)
|
||||
if (this.rpc.available) {
|
||||
effect(() => {
|
||||
this.rpc.send.workspacesSync({
|
||||
workspaces: this.workspaces().map((ws) => ({
|
||||
id: ws.id,
|
||||
name: this.workspaceName(ws),
|
||||
remote: this.workspaceIsRemote(ws),
|
||||
sessionIds: [ws.left.sessionId(), ws.right.sessionId()],
|
||||
})),
|
||||
activeId: this.activeWorkspaceId(),
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// a session died on its own — reset every panel bound to it, in any tab
|
||||
this.rpc.onSessionClosed((event) => {
|
||||
for (const workspace of this.workspaces()) {
|
||||
|
||||
@@ -86,4 +86,21 @@ export class RpcService {
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/** Fire-and-forget messages to the bun process (e.g. workspacesSync). */
|
||||
get send() {
|
||||
const rpc = this.rpc;
|
||||
if (!rpc) throw new Error('RPC is only available inside the desktop app');
|
||||
const ready = this.ready;
|
||||
return new Proxy({} as (typeof rpc)['send'], {
|
||||
get:
|
||||
(_target, message: string) =>
|
||||
(payload?: unknown) => {
|
||||
void ready.then(() => {
|
||||
const messages = rpc.send as unknown as Record<string, (p?: unknown) => void>;
|
||||
messages[message](payload);
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user