macOS application menu
Standard menus (App: hide/quit; Edit: clipboard roles enabling Cmd+C/V/X/Z; View: Refresh Cmd+R + fullscreen; Window: minimize/zoom/cycle) plus File with New/Close Tab (Cmd+T/W), New Folder/File, and a Connect submenu built from saved connections (folders as nested submenus, Connection Manager entry). Custom actions forward to the webview as menuAction messages; the menu rebuilds whenever connections change. macOS-only per electrobun support. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
+16
-3
@@ -18,7 +18,10 @@ export interface AppDeps {
|
||||
store: ConnectionStore;
|
||||
settings: SettingsStore;
|
||||
/** Assigned after the rpc object exists (it needs rpc.send). */
|
||||
events: { sessionClosed: (info: { sessionId: string; reason: string }) => void };
|
||||
events: {
|
||||
sessionClosed: (info: { sessionId: string; reason: string }) => void;
|
||||
connectionsChanged: () => void;
|
||||
};
|
||||
}
|
||||
|
||||
async function wrap<T extends object>(fn: () => Promise<T> | T): Promise<Result<T>> {
|
||||
@@ -121,20 +124,30 @@ export function createAppRPC({ registry, engine, store, settings, events }: AppD
|
||||
getConnections: () => wrap(async () => ({ store: await store.load() })),
|
||||
|
||||
upsertConnection: ({ connection }) =>
|
||||
wrap(async () => ({ id: await store.upsertConnection(connection) })),
|
||||
wrap(async () => {
|
||||
const id = await store.upsertConnection(connection);
|
||||
events.connectionsChanged();
|
||||
return { id };
|
||||
}),
|
||||
|
||||
deleteConnection: ({ id }) =>
|
||||
wrap(async () => {
|
||||
await store.deleteConnection(id);
|
||||
events.connectionsChanged();
|
||||
return {};
|
||||
}),
|
||||
|
||||
upsertFolder: ({ folder }) =>
|
||||
wrap(async () => ({ id: await store.upsertFolder(folder) })),
|
||||
wrap(async () => {
|
||||
const id = await store.upsertFolder(folder);
|
||||
events.connectionsChanged();
|
||||
return { id };
|
||||
}),
|
||||
|
||||
deleteFolder: ({ id }) =>
|
||||
wrap(async () => {
|
||||
await store.deleteFolder(id);
|
||||
events.connectionsChanged();
|
||||
return {};
|
||||
}),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user