gloomberb 0.19.5 → 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/LICENSE +0 -4
- package/package.json +6 -5
- package/patches/@opentui%2Fcore@0.3.2.patch +86 -25
- package/patches/electrobun-devkit@2.0.5.patch +148 -0
- package/src/api-client/bond-trades.ts +59 -0
- package/src/api-client/data.ts +21 -0
- package/src/api-client/equity-screener.ts +23 -0
- package/src/api-client/index.ts +2 -0
- package/src/api-client/types/account.ts +86 -0
- package/src/api-client/types/assist.ts +32 -0
- package/src/api-client/types/auth.ts +63 -0
- package/src/api-client/types/billing.ts +54 -0
- package/src/api-client/types/chat.ts +180 -0
- package/src/api-client/types/congress.ts +107 -0
- package/src/api-client/types/credit.ts +110 -0
- package/src/api-client/types/econ.ts +158 -0
- package/src/api-client/types/equity-diagnostic.ts +73 -0
- package/src/api-client/types/filings-and-calls.ts +350 -0
- package/src/api-client/types/index.ts +25 -0
- package/src/api-client/types/jobs.ts +147 -0
- package/src/api-client/types/market.ts +122 -0
- package/src/api-client/types/news.ts +91 -0
- package/src/api-client/types/notes-and-theses.ts +172 -0
- package/src/api-client/types/quotes.ts +28 -0
- package/src/api-client/types/scanners.ts +125 -0
- package/src/api-client/types/screener.ts +65 -0
- package/src/api-client/types/search.ts +107 -0
- package/src/api-client/types/sync.ts +14 -0
- package/src/api-client/types/team-collections.ts +43 -0
- package/src/api-client/types/team-views.ts +32 -0
- package/src/api-client/types/teams.ts +135 -0
- package/src/api-client/types/ticker-data.ts +57 -0
- package/src/api-client/types/tweets.ts +59 -0
- package/src/api-client/types/world-venues.ts +23 -0
- package/src/app/pane-runtime/index.tsx +2 -0
- package/src/app/pane-runtime/plugin-bindings.ts +10 -1
- package/src/app/runtime/desktop-deeplink.ts +41 -6
- package/src/app/star-prompt/status-line.tsx +1 -1
- package/src/app.tsx +64 -23
- package/src/architecture/ui-tokens-allowlist.json +0 -8
- package/src/cli/commands/market.ts +149 -10
- package/src/cli/commands/search.ts +21 -3
- package/src/cli/commands/ticker.ts +90 -36
- package/src/cli/desktop-pane-shot-browser.ts +69 -3
- package/src/cli/glossary.ts +3 -3
- package/src/cli/known-gaps.ts +8 -0
- package/src/cli/listing-arg.ts +12 -0
- package/src/cli/pane-functions/capabilities.ts +2 -0
- package/src/cli/pane-functions/catalog.ts +25 -5
- package/src/cli/pane-functions/function-help.ts +8 -5
- package/src/cli/pane-functions/headless.ts +4 -3
- package/src/cli/pane-functions/resolver.ts +75 -2
- package/src/cli/quote-answer.ts +9 -0
- package/src/cli/symbol-list.ts +54 -2
- package/src/cli/symbol-rows.ts +14 -2
- package/src/cli/ticker-resolution.ts +89 -20
- package/src/components/chart/composite/axis-overlays.tsx +60 -27
- package/src/components/chart/composite/composite-chart.tsx +118 -63
- package/src/components/chart/composite/cursor-source.ts +111 -0
- package/src/components/chart/composite/format.ts +168 -6
- package/src/components/chart/composite/legend.tsx +8 -4
- package/src/components/chart/composite/panel-labels.ts +20 -1
- package/src/components/chart/composite/panel-surface.tsx +201 -92
- package/src/components/chart/composite/price-axis-labels.tsx +92 -46
- package/src/components/chart/composite/price-series.ts +31 -8
- package/src/components/chart/composite/scene.ts +154 -59
- package/src/components/chart/composite/series-axis-tags.tsx +4 -2
- package/src/components/chart/composite/time-axis.ts +13 -5
- package/src/components/chart/composite/time-scale.ts +211 -56
- package/src/components/chart/composite/types.ts +11 -1
- package/src/components/chart/composite/use-composite-chart-keyboard.ts +43 -14
- package/src/components/chart/curve/curve-surface.tsx +5 -2
- package/src/components/chart/curve/model.ts +4 -1
- package/src/components/chart/native/use-bitmap-metrics.ts +81 -0
- package/src/components/chart/static/series.ts +3 -0
- package/src/components/command-bar/commands/collection-list.ts +81 -0
- package/src/components/command-bar/commands/direct/index.ts +6 -0
- package/src/components/command-bar/commands/registry.ts +8 -0
- package/src/components/command-bar/layout-items/current-layout.ts +22 -1
- package/src/components/command-bar/layout-items/focused-pane.ts +22 -1
- package/src/components/command-bar/pane-templates/items.ts +19 -3
- package/src/components/command-bar/pane-templates/workflow.ts +5 -0
- package/src/components/command-bar/routes/root/results.ts +23 -3
- package/src/components/command-bar/routes/root/selection.ts +4 -2
- package/src/components/command-bar/routes/root/shortcut-feedback.ts +1 -1
- package/src/components/command-bar/routes/root/shortcut-items.ts +3 -4
- package/src/components/command-bar/routes/root/shortcuts.ts +58 -14
- package/src/components/command-bar/routes/root/ticker-first.ts +32 -0
- package/src/components/command-bar/surface/environment.ts +2 -0
- package/src/components/command-bar/view-model.ts +7 -0
- package/src/components/command-bar/workflow/ops.ts +2 -1
- package/src/components/command-bar/workflow/tickers.ts +20 -0
- package/src/components/data-table/export.ts +4 -1
- package/src/components/layout/detached-pane-shell.tsx +10 -37
- package/src/components/layout/double-escape-close.ts +90 -0
- package/src/components/layout/header.tsx +3 -2
- package/src/components/layout/market-summary.ts +6 -3
- package/src/components/layout/pane/footer/index.tsx +2 -6
- package/src/components/layout/pane/footer/model.ts +6 -12
- package/src/components/layout/shell/active-drag.ts +53 -11
- package/src/components/layout/shell/drag/magnets.ts +128 -19
- package/src/components/layout/shell/menu.ts +15 -1
- package/src/components/layout/shell/pane/actions.ts +10 -2
- package/src/components/layout/shell/pane/management-shortcuts.ts +13 -51
- package/src/components/layout/shell/ticker-link-menu.ts +12 -3
- package/src/components/layout/status-bar.tsx +24 -78
- package/src/components/layout/status-widget-space.ts +5 -5
- package/src/components/onboarding/onboarding-keyboard.ts +5 -1
- package/src/components/onboarding/onboarding-wizard.tsx +15 -4
- package/src/components/onboarding/portfolio-step/positions-panel.tsx +9 -6
- package/src/components/onboarding/use-onboarding-progress.ts +20 -1
- package/src/components/price-sparkline/view.tsx +14 -6
- package/src/components/ticker/badge/index.tsx +8 -4
- package/src/components/ticker/badge/list.tsx +23 -7
- package/src/components/ui/column-grid.tsx +8 -2
- package/src/components/ui/data-table/index.tsx +5 -1
- package/src/components/ui/data-table/opentui/model.ts +4 -1
- package/src/components/ui/data-table/render-cell.ts +19 -0
- package/src/components/ui/delayed-mark.tsx +59 -7
- package/src/components/ui/icon.tsx +1 -8
- package/src/components/ui/menu.tsx +6 -1
- package/src/components/ui/tabs.tsx +5 -2
- package/src/core/state/app/layout.ts +18 -3
- package/src/core/state/app/state.ts +2 -0
- package/src/core/state/app/types.ts +5 -0
- package/src/data/config/layout.ts +3 -0
- package/src/data/config/store/normalize.ts +39 -4
- package/src/i18n/es.ts +13 -3
- package/src/i18n/ja.ts +13 -3
- package/src/i18n/ko.ts +13 -3
- package/src/i18n/zh-cn.ts +13 -3
- package/src/i18n/zh-tw.ts +13 -3
- package/src/layout/pane-manager/floating-placement.ts +7 -4
- package/src/layout/pane-manager/floating.ts +5 -2
- package/src/market-data/bond-funds.ts +19 -0
- package/src/market-data/futures-contract.ts +14 -3
- package/src/market-data/market/freshness.ts +18 -0
- package/src/market-data/market/status.ts +15 -2
- package/src/plugins/builtin/bond-calculator/headless.ts +2 -1
- package/src/plugins/builtin/bond-calculator/index.tsx +1 -1
- package/src/plugins/builtin/bond-calculator/model.ts +14 -5
- package/src/plugins/builtin/bond-calculator/pane.tsx +1 -1
- package/src/plugins/builtin/buildout/cells.tsx +25 -45
- package/src/plugins/builtin/buildout/detail/company.tsx +3 -3
- package/src/plugins/builtin/buildout/detail/index.tsx +1 -1
- package/src/plugins/builtin/buildout/detail/intel.tsx +4 -7
- package/src/plugins/builtin/buildout/detail/site.tsx +4 -4
- package/src/plugins/builtin/buildout/detail/ui.tsx +39 -38
- package/src/plugins/builtin/buildout/format.ts +23 -1
- package/src/plugins/builtin/buildout/model/types.ts +1 -0
- package/src/plugins/builtin/buildout/pane/index.tsx +2 -8
- package/src/plugins/builtin/buildout/table-model.ts +12 -4
- package/src/plugins/builtin/cds/headless.ts +1 -0
- package/src/plugins/builtin/cds/index.tsx +1 -1
- package/src/plugins/builtin/chat/content/composer.tsx +21 -27
- package/src/plugins/builtin/chat/content/index.tsx +31 -3
- package/src/plugins/builtin/chat/content/shortcuts.ts +4 -2
- package/src/plugins/builtin/chat/content/snapshot.ts +0 -3
- package/src/plugins/builtin/cloud/auth-actions.tsx +51 -23
- package/src/plugins/builtin/cloud/plugin.tsx +2 -0
- package/src/plugins/builtin/cloud/trial-offer-status-widget.tsx +3 -3
- package/src/plugins/builtin/cloud/upgrade-status-widget.tsx +44 -12
- package/src/plugins/builtin/congress-trades/model.ts +2 -1
- package/src/plugins/builtin/congress-trades/pane.tsx +3 -0
- package/src/plugins/builtin/correlation/headless.ts +3 -2
- package/src/plugins/builtin/crypto-board/pane.tsx +5 -4
- package/src/plugins/builtin/custom-view/index.tsx +1 -1
- package/src/plugins/builtin/custom-view/loader.ts +85 -8
- package/src/plugins/builtin/custom-view/view-spec.ts +28 -0
- package/src/plugins/builtin/debt-maturities/headless.ts +11 -2
- package/src/plugins/builtin/debt-maturities/model.ts +66 -0
- package/src/plugins/builtin/debt-maturities/pane.tsx +23 -4
- package/src/plugins/builtin/earnings-ripple/pane.tsx +1 -1
- package/src/plugins/builtin/econ/calendar-model.ts +28 -6
- package/src/plugins/builtin/equity-screener/client.ts +1 -1
- package/src/plugins/builtin/equity-screener/criterion-editor.tsx +16 -19
- package/src/plugins/builtin/equity-screener/headless.ts +37 -3
- package/src/plugins/builtin/equity-screener/ideas.ts +67 -3
- package/src/plugins/builtin/equity-screener/model.ts +238 -27
- package/src/plugins/builtin/equity-screener/pane.tsx +88 -18
- package/src/plugins/builtin/equity-screener/screen-check.ts +7 -4
- package/src/plugins/builtin/equity-screener/watchlist.ts +33 -0
- package/src/plugins/builtin/executives/format.ts +5 -4
- package/src/plugins/builtin/executives/pane.tsx +1 -1
- package/src/plugins/builtin/futures-curve/client.ts +19 -0
- package/src/plugins/builtin/futures-curve/headless.ts +52 -13
- package/src/plugins/builtin/futures-curve/index.tsx +1 -1
- package/src/plugins/builtin/futures-curve/model.ts +77 -6
- package/src/plugins/builtin/futures-curve/pane.tsx +19 -3
- package/src/plugins/builtin/help/index.tsx +55 -1
- package/src/plugins/builtin/insider/model.ts +30 -2
- package/src/plugins/builtin/jobs/model.ts +2 -2
- package/src/plugins/builtin/macro-day/client.ts +41 -0
- package/src/plugins/builtin/macro-day/headless.ts +19 -9
- package/src/plugins/builtin/macro-day/model.ts +3 -1
- package/src/plugins/builtin/market-movers/index.tsx +4 -3
- package/src/plugins/builtin/mna/distress/headless.ts +1 -0
- package/src/plugins/builtin/mna/model.ts +2 -2
- package/src/plugins/builtin/notes/files.ts +2 -0
- package/src/plugins/builtin/notes/owner.tsx +20 -1
- package/src/plugins/builtin/notes/quick-notes-pane.tsx +22 -4
- package/src/plugins/builtin/notes/store.ts +6 -1
- package/src/plugins/builtin/perps/pane.tsx +3 -1
- package/src/plugins/builtin/portfolio-list/cli/bulk-symbols.ts +17 -0
- package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +2 -1
- package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +2 -1
- package/src/plugins/builtin/portfolio-list/header.tsx +1 -1
- package/src/plugins/builtin/rate-path/headless.ts +24 -10
- package/src/plugins/builtin/research/corporate-actions-pane.tsx +29 -25
- package/src/plugins/builtin/research/event-model.ts +10 -3
- package/src/plugins/builtin/research/events-headless.ts +20 -2
- package/src/plugins/builtin/sec/fund-facts.ts +17 -1
- package/src/plugins/builtin/sec/index.tsx +1 -1
- package/src/plugins/builtin/series-inventory.ts +1 -0
- package/src/plugins/builtin/shared/earnings-report.ts +7 -2
- package/src/plugins/builtin/shared/members-menu.tsx +103 -38
- package/src/plugins/builtin/shared/use-quote-board.ts +85 -46
- package/src/plugins/builtin/short-interest/headless.ts +1 -1
- package/src/plugins/builtin/short-interest/model.ts +15 -6
- package/src/plugins/builtin/short-interest/publications-model.ts +22 -1
- package/src/plugins/builtin/short-interest/publications-pane.tsx +13 -4
- package/src/plugins/builtin/short-interest/types.ts +2 -0
- package/src/plugins/builtin/short-interest/watch-model.ts +1 -1
- package/src/plugins/builtin/thirteenf/overlap-pane.tsx +3 -0
- package/src/plugins/builtin/thirteenf/pane.tsx +3 -0
- package/src/plugins/builtin/ticker-detail/overview/model.ts +5 -3
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +4 -4
- package/src/plugins/builtin/time-sales/pane.tsx +3 -2
- package/src/plugins/builtin/trace-bonds/client.ts +7 -4
- package/src/plugins/builtin/trace-bonds/detail.tsx +198 -0
- package/src/plugins/builtin/trace-bonds/headless.ts +62 -4
- package/src/plugins/builtin/trace-bonds/history.ts +155 -0
- package/src/plugins/builtin/trace-bonds/index.tsx +1 -1
- package/src/plugins/builtin/trace-bonds/pane.tsx +64 -5
- package/src/plugins/builtin/volatility/client.ts +6 -1
- package/src/plugins/builtin/volatility/headless.ts +0 -1
- package/src/plugins/builtin/yield-curve/curves.ts +15 -0
- package/src/plugins/builtin/yield-curve/headless.ts +6 -1
- package/src/plugins/builtin/yield-curve/index.tsx +5 -8
- package/src/plugins/host-modules.ts +22 -3
- package/src/plugins/host-smoke.ts +6 -3
- package/src/plugins/installer.ts +16 -3
- package/src/plugins/plugin-names.ts +11 -2
- package/src/portfolio/collection-name.ts +19 -0
- package/src/remote/controller.ts +9 -2
- package/src/remote/schema.ts +2 -1
- package/src/renderers/browser/http-proxy-transport.ts +78 -8
- package/src/renderers/cloudflare/http-proxy.ts +73 -3
- package/src/renderers/cloudflare/proxy-session.ts +47 -24
- package/src/renderers/cloudflare/worker.ts +44 -4
- package/src/renderers/desktop/geometry.ts +279 -0
- package/src/renderers/desktop/screen-setup.ts +246 -0
- package/src/renderers/desktop/sequential-window-host.ts +179 -0
- package/src/renderers/desktop/test-utils.ts +71 -0
- package/src/renderers/desktop/window-controller.ts +433 -0
- package/src/renderers/desktop/window-host.ts +70 -0
- package/src/renderers/desktop/window-layouts.ts +630 -0
- package/src/renderers/dom/data-frames.ts +15 -4
- package/src/renderers/dom/desktop/icons.tsx +0 -2
- package/src/renderers/dom/styles.css +0 -3
- package/src/renderers/electrobun/bun/application-menu/click.ts +1 -0
- package/src/renderers/electrobun/bun/application-menu/index.ts +4 -1
- package/src/renderers/electrobun/bun/desktop/backend-requests.ts +19 -8
- package/src/renderers/electrobun/bun/desktop/backend.ts +320 -19
- package/src/renderers/electrobun/bun/desktop/detached-windows.ts +83 -61
- package/src/renderers/electrobun/bun/desktop/host-requests.ts +4 -14
- package/src/renderers/electrobun/bun/desktop/initialization.ts +30 -11
- package/src/renderers/electrobun/bun/desktop/install-records.ts +59 -0
- package/src/renderers/electrobun/bun/desktop/installer-folder.ts +208 -592
- package/src/renderers/electrobun/bun/desktop/macos-objc.ts +14 -0
- package/src/renderers/electrobun/bun/desktop/screen-setup-file.ts +55 -0
- package/src/renderers/electrobun/bun/desktop/state-broadcaster.ts +44 -8
- package/src/renderers/electrobun/bun/desktop/update.ts +1 -1
- package/src/renderers/electrobun/bun/desktop/workspace/index.ts +298 -97
- package/src/renderers/electrobun/bun/desktop/workspace/requests.ts +44 -6
- package/src/renderers/electrobun/bun/index.ts +22 -109
- package/src/renderers/electrobun/bun/window/create.ts +23 -3
- package/src/renderers/electrobun/bun/window/electrobun-window-host.ts +306 -0
- package/src/renderers/electrobun/bun/window/events.ts +4 -4
- package/src/renderers/electrobun/bun/window/focus.ts +0 -25
- package/src/renderers/electrobun/bun/window/frame.ts +2 -1
- package/src/renderers/electrobun/bun/window/native-min-size.ts +322 -0
- package/src/renderers/electrobun/bun/window/remembered-frame.ts +4 -82
- package/src/renderers/electrobun/shared/protocol.ts +44 -2
- package/src/renderers/electrobun/view/backend-rpc.ts +16 -1
- package/src/renderers/electrobun/view/desktop/window/bridge.ts +63 -3
- package/src/renderers/electrobun/view/main.tsx +13 -7
- package/src/series/fred-argument.ts +17 -0
- package/src/sources/gloomberb-cloud/index.ts +5 -7
- package/src/sources/provider-router/batches.ts +18 -3
- package/src/sources/provider-router/financial-routes.ts +7 -1
- package/src/sources/provider-router/financials.ts +18 -4
- package/src/state/app/context/index.tsx +16 -2
- package/src/state/desktop-windows.ts +63 -0
- package/src/sync/other-window-tabs.ts +62 -0
- package/src/tickers/company-name-listing.ts +23 -3
- package/src/tickers/listing-fate.ts +147 -1
- package/src/tickers/terminal-codes.ts +5 -0
- package/src/time-series/types.ts +6 -0
- package/src/types/config.ts +10 -1
- package/src/types/data-provider.ts +14 -0
- package/src/types/desktop-window.ts +71 -2
- package/src/types/financials.ts +19 -3
- package/src/types/headless.ts +21 -0
- package/src/types/plugin.ts +6 -0
- package/src/ui/index.tsx +14 -13
- package/src/ui/same-props.ts +58 -0
- package/src/utils/cli-output.ts +33 -4
- package/src/utils/double-escape-close.ts +38 -16
- package/src/utils/format.ts +30 -5
- package/src/utils/futures-generic.ts +12 -0
- package/src/utils/http-proxy-upstream.ts +6 -2
- package/src/utils/plugin-proxy-hosts.json +0 -4
- package/src/utils/plugin-proxy-hosts.ts +22 -0
- package/src/utils/price-earnings.ts +18 -0
- package/src/utils/sec-filings.ts +7 -1
- package/patches/electrobun@1.18.1.patch +0 -633
- package/src/api-client/types.ts +0 -2441
|
@@ -1533,9 +1533,6 @@ html[data-gloom-screenshot="true"] [data-gloom-role="chart-watermark"] {
|
|
|
1533
1533
|
.gloom-icon-button:disabled, [data-gloom-role="pane-footer-icon"] { cursor: default; }
|
|
1534
1534
|
.gloom-icon-button:not(:disabled):hover { background: var(--gloom-hover-fill); color: var(--gloom-text-bright); }
|
|
1535
1535
|
.gloom-icon-button[aria-pressed="true"] { color: var(--gloom-warning); }
|
|
1536
|
-
/* A status's few characters after its icon (a delay's 15m): read without hovering, in the muted tone of the meta text around it. */
|
|
1537
|
-
.gloom-icon-button-text, [data-gloom-role="pane-footer-icon-text"] { margin-left: var(--gloom-space-xs); color: var(--gloom-text-muted); }
|
|
1538
|
-
.gloom-icon-button:not(:disabled):hover .gloom-icon-button-text { color: inherit; }
|
|
1539
1536
|
.gloom-qb-view button:disabled { color: var(--gloom-text-muted); opacity: 0.55; cursor: default; }
|
|
1540
1537
|
[data-gloom-role="field-grid-value"] button,
|
|
1541
1538
|
[data-gloom-role="field-grid-value"] button > span { justify-content: flex-end !important; text-align: right; padding-inline: 0 !important; }
|
|
@@ -9,7 +9,8 @@ const GITHUB_ISSUE_URL = "https://github.com/gloom-sh/gloomberb/issues/new/choos
|
|
|
9
9
|
|
|
10
10
|
export type ElectrobunApplicationMenuCommand =
|
|
11
11
|
| DesktopApplicationMenuCommand
|
|
12
|
-
| { type: "open-devtools" }
|
|
12
|
+
| { type: "open-devtools" }
|
|
13
|
+
| { type: "new-window" };
|
|
13
14
|
|
|
14
15
|
function commandItem(
|
|
15
16
|
label: string,
|
|
@@ -49,6 +50,8 @@ function buildApplicationMenu(keybindings: ResolvedKeybindings): ApplicationMenu
|
|
|
49
50
|
{
|
|
50
51
|
label: "File",
|
|
51
52
|
submenu: [
|
|
53
|
+
commandItem("New Window", { type: "new-window" }),
|
|
54
|
+
{ type: "divider" },
|
|
52
55
|
openCommandBar("Search Ticker...", "DES ", accelerator("ticker-search")),
|
|
53
56
|
{ type: "divider" },
|
|
54
57
|
commandItem("New Portfolio...", { type: "open-builtin-workflow", actionId: "new-portfolio" }),
|
|
@@ -13,7 +13,7 @@ import type {
|
|
|
13
13
|
} from "../../shared/protocol";
|
|
14
14
|
import { encodeRpcValue } from "../../shared/rpc-codec";
|
|
15
15
|
import { desktopBootFramePath, removeDesktopBootFrame } from "../window/boot-frame";
|
|
16
|
-
import { paneIdFromDetachedRpcKey } from "../window/focus";
|
|
16
|
+
import { MAIN_WINDOW_RPC_KEY, paneIdFromDetachedRpcKey } from "../window/focus";
|
|
17
17
|
import type { DesktopBackend, DesktopRpc } from "./backend";
|
|
18
18
|
import { createElectrobunDesktopUpdater } from "./update";
|
|
19
19
|
|
|
@@ -29,9 +29,13 @@ function sendUpdateProgress(rpc: DesktopRpc, progress: UpdateProgress): void {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* Every window but the main one closes, and the workspace and services go,
|
|
34
|
+
* before the data they read is replaced. Extra windows open again with the
|
|
35
|
+
* next session where their tabs are still there.
|
|
36
|
+
*/
|
|
33
37
|
function closeDesktopSession(backend: DesktopBackend): void {
|
|
34
|
-
backend.
|
|
38
|
+
backend.closeAllWindows();
|
|
35
39
|
backend.workspace = null;
|
|
36
40
|
backend.teardownServices();
|
|
37
41
|
}
|
|
@@ -68,11 +72,13 @@ export async function handleDesktopBackendRequest(
|
|
|
68
72
|
case "config.save": {
|
|
69
73
|
const desktopWorkspace = backend.workspace;
|
|
70
74
|
if (desktopWorkspace) {
|
|
71
|
-
//
|
|
72
|
-
|
|
75
|
+
// A popped-out window's save counts only for its own pane; a full
|
|
76
|
+
// window's for what it changed, among its own tabs.
|
|
77
|
+
const senderKey = backend.rpcs.getRpcWindowKey(rpc);
|
|
78
|
+
const senderDetachedPaneId = paneIdFromDetachedRpcKey(senderKey);
|
|
73
79
|
await backend.commitDesktopSnapshot(senderDetachedPaneId
|
|
74
80
|
? desktopWorkspace.replaceConfigFromDetachedPane(senderDetachedPaneId, request.payload.config)
|
|
75
|
-
: desktopWorkspace.
|
|
81
|
+
: desktopWorkspace.replaceConfigFromWindow(senderKey ?? MAIN_WINDOW_RPC_KEY, request.payload.config));
|
|
76
82
|
return null;
|
|
77
83
|
}
|
|
78
84
|
backend.setConfig(request.payload.config);
|
|
@@ -86,9 +92,14 @@ export async function handleDesktopBackendRequest(
|
|
|
86
92
|
removeDesktopBootFrame(desktopBootFramePath());
|
|
87
93
|
await resetAllData(request.payload.dataDir);
|
|
88
94
|
return null;
|
|
89
|
-
case "config.export":
|
|
90
|
-
|
|
95
|
+
case "config.export": {
|
|
96
|
+
// With more than one window, each has only its own tabs: the export is
|
|
97
|
+
// the whole config, every window's tabs included.
|
|
98
|
+
const workspace = backend.workspace;
|
|
99
|
+
const config = workspace && workspace.windowIds().length > 1 ? workspace.getSnapshot().config : request.payload.config;
|
|
100
|
+
await exportConfig(config, request.payload.destPath);
|
|
91
101
|
return null;
|
|
102
|
+
}
|
|
92
103
|
case "config.import": {
|
|
93
104
|
closeDesktopSession(backend);
|
|
94
105
|
await backend.startServices(await importConfig(request.payload.dataDir, request.payload.srcPath));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ApplicationMenu, BrowserView, Utils, type BrowserWindow } from "electrobun/bun";
|
|
1
|
+
import Electrobun, { ApplicationMenu, BrowserView, Screen, Utils, type BrowserWindow } from "electrobun/bun";
|
|
2
2
|
import { homedir } from "os";
|
|
3
3
|
import { createAppServices, type AppServices } from "../../../../core/app-services";
|
|
4
4
|
import { syncConfigActiveLayoutState, type PaneRuntimeState } from "../../../../core/state/app/state";
|
|
@@ -45,8 +45,20 @@ import {
|
|
|
45
45
|
prefetchExternalPluginBundles,
|
|
46
46
|
takeExternalPluginBundles,
|
|
47
47
|
} from "../external-plugins";
|
|
48
|
-
import { MAIN_WINDOW_RPC_KEY } from "../window/focus";
|
|
48
|
+
import { MAIN_WINDOW_RPC_KEY, paneIdFromDetachedRpcKey } from "../window/focus";
|
|
49
49
|
import { measureNativeWindowCalls } from "../window/native-timing";
|
|
50
|
+
import { createAppWindow } from "../window/create";
|
|
51
|
+
import { desktopBootFramePath, desktopBootFramePreload, readDesktopBootFrame } from "../window/boot-frame";
|
|
52
|
+
import { MAIN_WINDOW_MIN_SIZE, defaultMainWindowFrame } from "../window/frame";
|
|
53
|
+
import { ElectrobunWindowHost } from "../window/electrobun-window-host";
|
|
54
|
+
import { quitWindowsEventLoopOnItsThread } from "../window/windows-quit";
|
|
55
|
+
import { readRememberedDesktopWindow, rememberedDesktopWindowPath } from "../window/remembered-frame";
|
|
56
|
+
import { DesktopWindowController } from "../../../desktop/window-controller";
|
|
57
|
+
import { SequentialWindowHost } from "../../../desktop/sequential-window-host";
|
|
58
|
+
import { createExtraWindowId, MAIN_WINDOW_ID } from "../../../desktop/screen-setup";
|
|
59
|
+
import type { OpenWindowSpec } from "../../../desktop/window-host";
|
|
60
|
+
import type { DesktopWindowInfo, OtherWindowTab } from "../../../../types/desktop-window";
|
|
61
|
+
import { desktopScreenSetupStore } from "./screen-setup-file";
|
|
50
62
|
import { handleDesktopBackendRequest } from "./backend-requests";
|
|
51
63
|
import { detectDesktopInstallKind, removeUpdateAsides } from "./update";
|
|
52
64
|
import { removeLegacyMacApp } from "./app-name";
|
|
@@ -107,11 +119,35 @@ export class DesktopBackend {
|
|
|
107
119
|
config: AppConfig | null = null;
|
|
108
120
|
services: AppServices | null = null;
|
|
109
121
|
workspace: DesktopWorkspace | null = null;
|
|
110
|
-
|
|
122
|
+
/**
|
|
123
|
+
* Every window and screen goes through these: the host, which opens
|
|
124
|
+
* native windows one at a time, and the full windows' placement on the
|
|
125
|
+
* screens. `nativeWindows` is the Electrobun host under it, for the calls
|
|
126
|
+
* only this shell makes.
|
|
127
|
+
*/
|
|
128
|
+
windowHost: SequentialWindowHost | null = null;
|
|
129
|
+
windowController: DesktopWindowController | null = null;
|
|
130
|
+
private nativeWindows: ElectrobunWindowHost | null = null;
|
|
111
131
|
|
|
112
132
|
readonly rpcs = createDesktopRpcRegistry<DesktopRpc>();
|
|
113
133
|
readonly stateBroadcaster = new DesktopStateBroadcaster<DesktopRpc>({
|
|
114
134
|
forEachReadyWindowRpc: this.rpcs.forEachReadyWindowRpc,
|
|
135
|
+
// A full window draws its own tabs; a popped-out pane's window draws the main window's.
|
|
136
|
+
viewKey: (rpc) => {
|
|
137
|
+
const key = this.rpcs.getRpcWindowKey(rpc) ?? MAIN_WINDOW_ID;
|
|
138
|
+
return paneIdFromDetachedRpcKey(key) ? MAIN_WINDOW_ID : key;
|
|
139
|
+
},
|
|
140
|
+
// With one window its view is the shared state: nothing to project or keep.
|
|
141
|
+
project: (viewKey, shared) => {
|
|
142
|
+
const workspace = this.workspace;
|
|
143
|
+
return workspace && workspace.windowIds().length > 1 ? workspace.peekWindowSnapshot(viewKey) ?? shared : shared;
|
|
144
|
+
},
|
|
145
|
+
delivered: (rpc, snapshot) => {
|
|
146
|
+
const workspace = this.workspace;
|
|
147
|
+
const key = this.rpcs.getRpcWindowKey(rpc);
|
|
148
|
+
if (!workspace || !key || typeof snapshot.stateSeq !== "number" || workspace.windowIds().length <= 1) return;
|
|
149
|
+
workspace.noteDelivered(key, snapshot.stateSeq, snapshot);
|
|
150
|
+
},
|
|
115
151
|
});
|
|
116
152
|
readonly capabilityBridge = new DesktopCapabilityBridge<DesktopRpc>({
|
|
117
153
|
getRegistry: () => this.requireServices().pluginRegistry.capabilities,
|
|
@@ -131,6 +167,244 @@ export class DesktopBackend {
|
|
|
131
167
|
private remoteControlServer: RemoteControlServer | null = null;
|
|
132
168
|
private readonly pendingDeepLinks: string[] = [];
|
|
133
169
|
private readonly contextMenuRequestRpcs = new Map<string, DesktopRpc>();
|
|
170
|
+
/** Extra windows open once the main window has drawn, like popped-out panes. */
|
|
171
|
+
private extraWindowsAllowed = false;
|
|
172
|
+
private lastWindowList = "";
|
|
173
|
+
/** What the main window was last told the other windows' tabs are. */
|
|
174
|
+
private lastOtherWindowTabs = "[]";
|
|
175
|
+
private quitting = false;
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Makes the window host, opens the main window where it was left on these
|
|
179
|
+
* screens, and starts watching them. Extra windows open once the main
|
|
180
|
+
* window has its data.
|
|
181
|
+
*/
|
|
182
|
+
startWindows(): void {
|
|
183
|
+
if (this.windowHost) return;
|
|
184
|
+
const shell = new ElectrobunWindowHost({
|
|
185
|
+
create: (spec, hooks) => this.createNativeWindow(spec, hooks.onFrameChange),
|
|
186
|
+
readDisplays: () => Screen.getAllDisplays(),
|
|
187
|
+
});
|
|
188
|
+
const host = new SequentialWindowHost(shell, {
|
|
189
|
+
canReopen: (spec) => spec.id !== MAIN_WINDOW_ID,
|
|
190
|
+
onNeverDrew: (id) => console.error("[desktop] a window never drew", { kind: paneIdFromDetachedRpcKey(id) ? "pane" : "app" }),
|
|
191
|
+
});
|
|
192
|
+
this.nativeWindows = shell;
|
|
193
|
+
this.windowHost = host;
|
|
194
|
+
const legacy = readRememberedDesktopWindow(rememberedDesktopWindowPath());
|
|
195
|
+
this.windowController = new DesktopWindowController({
|
|
196
|
+
host,
|
|
197
|
+
store: desktopScreenSetupStore(),
|
|
198
|
+
minSize: MAIN_WINDOW_MIN_SIZE,
|
|
199
|
+
defaultMainFrame: defaultMainWindowFrame(),
|
|
200
|
+
// Windows saved every window as full screen in builds whose frameless
|
|
201
|
+
// window it took for full screen; it has no way into full screen here.
|
|
202
|
+
legacyMainPlacement: legacy ? { ...legacy, fullscreen: legacy.fullscreen && process.platform !== "win32" } : null,
|
|
203
|
+
onWindowClosed: (windowId) => this.handleExtraWindowClosed(windowId),
|
|
204
|
+
onMainWindowClosed: () => this.quit(),
|
|
205
|
+
});
|
|
206
|
+
host.onWindowEvent((event) => {
|
|
207
|
+
this.detachedWindows.handleWindowEvent(event);
|
|
208
|
+
// A page that has not started yet draws as shown; it is told once it hides again.
|
|
209
|
+
if (event.type !== "visibility" || !this.rpcs.isWindowRpcReady(event.id)) return;
|
|
210
|
+
this.rpcs.getWindowRpc(event.id)?.send["desktop.windowVisibility"]({ visible: event.visible });
|
|
211
|
+
});
|
|
212
|
+
// A quit from outside the app (the Dock, logging out) does not come
|
|
213
|
+
// through `quit`: where the windows are is written here. Registered
|
|
214
|
+
// before the main window opens, so it runs before the shell's own
|
|
215
|
+
// handlers wait for the windows to go.
|
|
216
|
+
Electrobun.events.on("before-quit", () => {
|
|
217
|
+
if (!this.quitting) this.windowController?.flush();
|
|
218
|
+
});
|
|
219
|
+
this.windowController.openWindow(MAIN_WINDOW_ID);
|
|
220
|
+
this.windowController.focus(MAIN_WINDOW_ID);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/** The native window behind a full window or a popped-out pane, with its own RPC channel. */
|
|
224
|
+
private createNativeWindow(spec: OpenWindowSpec, onFrameChange: () => void): BrowserWindow {
|
|
225
|
+
const rpc = this.createWindowRpc(spec.id);
|
|
226
|
+
const main = spec.id === MAIN_WINDOW_ID;
|
|
227
|
+
const window = createAppWindow({
|
|
228
|
+
title: spec.title,
|
|
229
|
+
frame: spec.frame,
|
|
230
|
+
rpc,
|
|
231
|
+
minSize: spec.minSize,
|
|
232
|
+
onFrameChange,
|
|
233
|
+
// A full window's page draws a frame before its script has loaded: the
|
|
234
|
+
// main window the layout it last drew (dom/boot-frame.ts), another the
|
|
235
|
+
// bare shell. A popped-out pane's draws none.
|
|
236
|
+
...(spec.kind === "app"
|
|
237
|
+
? { preload: desktopBootFramePreload(main ? readDesktopBootFrame(desktopBootFramePath()) : null) }
|
|
238
|
+
: {}),
|
|
239
|
+
});
|
|
240
|
+
if (main) quitWindowsEventLoopOnItsThread(window);
|
|
241
|
+
return window;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/** Brings a window forward by its RPC key: a full window's or a popped-out pane's. False when there is none. */
|
|
245
|
+
focusWindow(windowKey: string | undefined): boolean {
|
|
246
|
+
const host = this.windowHost;
|
|
247
|
+
if (!windowKey || !host?.hasWindow(windowKey)) return false;
|
|
248
|
+
if (this.windowController?.isOpen(windowKey)) this.windowController.focus(windowKey);
|
|
249
|
+
else host.focusWindow(windowKey);
|
|
250
|
+
return true;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/** The Electrobun window for an RPC key, for the calls only this shell makes. */
|
|
254
|
+
nativeWindow(windowKey: string | undefined): BrowserWindow | null {
|
|
255
|
+
return windowKey ? this.nativeWindows?.browserWindow(windowKey) ?? null : null;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/** The main window has its data: popped-out panes and extra windows open shortly after. */
|
|
259
|
+
openWindowsAfterMainWindow(): void {
|
|
260
|
+
this.detachedWindows.openAfterMainWindow(() => {
|
|
261
|
+
this.extraWindowsAllowed = true;
|
|
262
|
+
this.reconcileWindows();
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/** Opens and closes windows to match the workspace: popped-out panes, and full windows. */
|
|
267
|
+
reconcileWindows(): void {
|
|
268
|
+
this.detachedWindows.reconcile();
|
|
269
|
+
const controller = this.windowController;
|
|
270
|
+
const workspace = this.workspace;
|
|
271
|
+
if (!controller || !workspace) return;
|
|
272
|
+
const wanted = workspace.windowIds();
|
|
273
|
+
if (this.extraWindowsAllowed) {
|
|
274
|
+
for (const windowId of wanted) {
|
|
275
|
+
if (windowId !== MAIN_WINDOW_ID && !controller.isOpen(windowId)) controller.openWindow(windowId);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
for (const windowId of controller.openWindowIds()) {
|
|
279
|
+
if (windowId === MAIN_WINDOW_ID || wanted.includes(windowId)) continue;
|
|
280
|
+
controller.closeWindow(windowId, { forget: true });
|
|
281
|
+
this.releaseWindow(windowId);
|
|
282
|
+
}
|
|
283
|
+
controller.rememberWindows(workspace.extraWindows());
|
|
284
|
+
this.sendWindowList();
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/** Every full window, labelled in the order they opened. */
|
|
288
|
+
windowInfos(): DesktopWindowInfo[] {
|
|
289
|
+
const workspace = this.workspace;
|
|
290
|
+
if (!workspace) return [];
|
|
291
|
+
return workspace.windowIds().map((id, index) => {
|
|
292
|
+
const tabs = workspace.windowTabNames(id);
|
|
293
|
+
return {
|
|
294
|
+
id,
|
|
295
|
+
number: index + 1,
|
|
296
|
+
activeLayoutName: tabs?.active ?? "",
|
|
297
|
+
tabCount: tabs?.count ?? 0,
|
|
298
|
+
};
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/** Tells every full window which windows there are, when that changed. */
|
|
303
|
+
private sendWindowList(): void {
|
|
304
|
+
this.sendOtherWindowTabs();
|
|
305
|
+
const windows = this.windowInfos();
|
|
306
|
+
const key = JSON.stringify(windows);
|
|
307
|
+
if (key === this.lastWindowList) return;
|
|
308
|
+
this.lastWindowList = key;
|
|
309
|
+
for (const { id } of windows) {
|
|
310
|
+
if (!this.rpcs.isWindowRpcReady(id)) continue;
|
|
311
|
+
this.rpcs.getWindowRpc(id)?.send["desktop.windows"]({ windows });
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/** The tabs the other windows hold, for the main window's init; later changes come as messages. */
|
|
316
|
+
otherWindowTabsForInit(): OtherWindowTab[] {
|
|
317
|
+
const tabs = this.workspace?.otherWindowTabs() ?? [];
|
|
318
|
+
this.lastOtherWindowTabs = JSON.stringify(tabs);
|
|
319
|
+
return tabs;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/** Tells the main window when the tabs the other windows hold changed: its cloud sync pushes every window's tabs. */
|
|
323
|
+
private sendOtherWindowTabs(): void {
|
|
324
|
+
const workspace = this.workspace;
|
|
325
|
+
if (!workspace || !this.rpcs.isWindowRpcReady(MAIN_WINDOW_ID)) return;
|
|
326
|
+
const tabs = workspace.otherWindowTabs();
|
|
327
|
+
// One window: none, as the main window already knows.
|
|
328
|
+
if (tabs.length === 0 && this.lastOtherWindowTabs === "[]") return;
|
|
329
|
+
const key = JSON.stringify(tabs);
|
|
330
|
+
if (key === this.lastOtherWindowTabs) return;
|
|
331
|
+
this.lastOtherWindowTabs = key;
|
|
332
|
+
this.rpcs.getWindowRpc(MAIN_WINDOW_ID)?.send["desktop.otherWindowTabs"]({ tabs: encodeRpcValue(tabs) });
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/** A full window's id for a request, or null for a popped-out pane's window. */
|
|
336
|
+
fullWindowKey(rpc: DesktopRpc): string | null {
|
|
337
|
+
const key = this.rpcs.getRpcWindowKey(rpc);
|
|
338
|
+
if (!key || paneIdFromDetachedRpcKey(key)) return null;
|
|
339
|
+
return key;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/** Opens a new full window, on `layoutId` or an empty tab. Null when that tab cannot leave its window. */
|
|
343
|
+
async openExtraWindow(holding?: { layoutId?: string; paneId?: string }): Promise<string | null> {
|
|
344
|
+
const workspace = this.requireWorkspace();
|
|
345
|
+
const windowId = createExtraWindowId();
|
|
346
|
+
const snapshot = workspace.openWindow(windowId, holding);
|
|
347
|
+
if (!snapshot) return null;
|
|
348
|
+
this.extraWindowsAllowed = true;
|
|
349
|
+
await this.commitDesktopSnapshot(snapshot);
|
|
350
|
+
this.windowController?.focus(windowId);
|
|
351
|
+
return windowId;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Shows a pane wherever it is: brings its window forward, on its tab, and
|
|
356
|
+
* has that window focus it. False when no window holds it.
|
|
357
|
+
*/
|
|
358
|
+
async focusPaneAnywhere(paneId: string): Promise<boolean> {
|
|
359
|
+
const workspace = this.requireWorkspace();
|
|
360
|
+
const config = this.config;
|
|
361
|
+
if (config && config.layout.detached.some((entry) => entry.instanceId === paneId)) {
|
|
362
|
+
return this.detachedWindows.focusDetachedPane(paneId);
|
|
363
|
+
}
|
|
364
|
+
const located = workspace.locatePane(paneId);
|
|
365
|
+
if (!located) return false;
|
|
366
|
+
const before = workspace.getWindowSnapshot(located.windowId);
|
|
367
|
+
const shown = before?.config.layouts[before.config.activeLayoutIndex]?.id;
|
|
368
|
+
if (shown !== located.layoutId) {
|
|
369
|
+
await this.commitDesktopSnapshot(workspace.activateLayout(located.windowId, located.layoutId), { persistConfig: false });
|
|
370
|
+
}
|
|
371
|
+
this.windowController?.focus(located.windowId);
|
|
372
|
+
this.rpcs.getWindowRpc(located.windowId)?.send["desktop.focusPane"]({ paneId });
|
|
373
|
+
return true;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
private handleExtraWindowClosed(windowId: string): void {
|
|
377
|
+
this.releaseWindow(windowId);
|
|
378
|
+
// Closed by the quit itself: it opens again with its tabs at the next launch.
|
|
379
|
+
if (this.quitting) return;
|
|
380
|
+
const workspace = this.workspace;
|
|
381
|
+
if (!workspace || !workspace.windowIds().includes(windowId)) return;
|
|
382
|
+
void this.commitDesktopSnapshot(workspace.closeWindow(windowId));
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
/** What a closed full window held: its streams, its channel. */
|
|
386
|
+
private releaseWindow(windowId: string): void {
|
|
387
|
+
this.disposeWindowResources(windowId);
|
|
388
|
+
this.rpcs.unregisterWindowRpc(windowId);
|
|
389
|
+
this.workspace?.forgetWindow(windowId);
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* Closes every window but the main one, without forgetting the extra
|
|
394
|
+
* ones, which open again at the next launch or session. Where each window
|
|
395
|
+
* is, the main one included, is written first.
|
|
396
|
+
*/
|
|
397
|
+
closeAllWindows(): void {
|
|
398
|
+
this.detachedWindows.closeAll();
|
|
399
|
+
const controller = this.windowController;
|
|
400
|
+
if (!controller) return;
|
|
401
|
+
controller.flush();
|
|
402
|
+
for (const windowId of controller.openWindowIds()) {
|
|
403
|
+
if (windowId === MAIN_WINDOW_ID) continue;
|
|
404
|
+
controller.closeWindow(windowId);
|
|
405
|
+
this.releaseWindow(windowId);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
134
408
|
|
|
135
409
|
requireConfig(): AppConfig {
|
|
136
410
|
if (!this.config) throw new Error("Backend config has not been initialized.");
|
|
@@ -207,8 +481,8 @@ export class DesktopBackend {
|
|
|
207
481
|
getConfig: () => this.requireConfig(),
|
|
208
482
|
getServices: () => this.requireServices(),
|
|
209
483
|
});
|
|
210
|
-
this.workspace = createDesktopWorkspace(config, this.getSessionSnapshot());
|
|
211
|
-
this.
|
|
484
|
+
this.workspace = createDesktopWorkspace(config, this.getSessionSnapshot(), this.windowController?.screenSetup.windows);
|
|
485
|
+
this.reconcileWindows();
|
|
212
486
|
return { config, services };
|
|
213
487
|
}
|
|
214
488
|
|
|
@@ -236,9 +510,10 @@ export class DesktopBackend {
|
|
|
236
510
|
await saveConfig(nextConfig);
|
|
237
511
|
}
|
|
238
512
|
if (options.reconcileWindows !== false) {
|
|
239
|
-
this.
|
|
513
|
+
this.reconcileWindows();
|
|
240
514
|
}
|
|
241
515
|
this.stateBroadcaster.sendDesktopState(this.requireWorkspace().getSnapshot());
|
|
516
|
+
this.sendWindowList();
|
|
242
517
|
return this.requireWorkspace().getSnapshot();
|
|
243
518
|
}
|
|
244
519
|
|
|
@@ -291,7 +566,7 @@ export class DesktopBackend {
|
|
|
291
566
|
if (this.pendingDeepLinks.length > MAX_PENDING_DEEP_LINKS) this.pendingDeepLinks.shift();
|
|
292
567
|
return;
|
|
293
568
|
}
|
|
294
|
-
this.
|
|
569
|
+
this.focusWindow(MAIN_WINDOW_RPC_KEY);
|
|
295
570
|
rpc.send["desktop.deepLink"]({ url: rawUrl });
|
|
296
571
|
}
|
|
297
572
|
|
|
@@ -313,13 +588,29 @@ export class DesktopBackend {
|
|
|
313
588
|
});
|
|
314
589
|
}
|
|
315
590
|
|
|
591
|
+
/** The full window the person used last, ready for messages; the main window otherwise. */
|
|
592
|
+
private focusedFullWindow(): { key: string; rpc: DesktopRpc } | null {
|
|
593
|
+
const focused = this.windowController?.focusedWindowId ?? MAIN_WINDOW_ID;
|
|
594
|
+
for (const key of [focused, MAIN_WINDOW_RPC_KEY]) {
|
|
595
|
+
const rpc = this.rpcs.getWindowRpc(key);
|
|
596
|
+
if (rpc && this.rpcs.isWindowRpcReady(key)) return { key, rpc };
|
|
597
|
+
}
|
|
598
|
+
return null;
|
|
599
|
+
}
|
|
600
|
+
|
|
316
601
|
runApplicationMenuCommand(command: ElectrobunApplicationMenuCommand): void {
|
|
317
602
|
if (command.type === "open-devtools") {
|
|
318
|
-
this.
|
|
603
|
+
this.nativeWindow(this.focusedFullWindow()?.key ?? MAIN_WINDOW_ID)?.webview.openDevTools();
|
|
604
|
+
return;
|
|
605
|
+
}
|
|
606
|
+
if (command.type === "new-window") {
|
|
607
|
+
if (this.workspace) void this.openExtraWindow().catch((error: unknown) => {
|
|
608
|
+
console.error("[desktop] could not open a window", summarizeError(error));
|
|
609
|
+
});
|
|
319
610
|
return;
|
|
320
611
|
}
|
|
321
|
-
const rpc = this.readyMainWindowRpc();
|
|
322
612
|
if (command.type === "quit") {
|
|
613
|
+
const rpc = this.readyMainWindowRpc();
|
|
323
614
|
if (!rpc) {
|
|
324
615
|
this.quit();
|
|
325
616
|
return;
|
|
@@ -330,21 +621,26 @@ export class DesktopBackend {
|
|
|
330
621
|
setTimeout(() => this.quit(), QUIT_FALLBACK_MS);
|
|
331
622
|
return;
|
|
332
623
|
}
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
624
|
+
// Menu commands go to the full window in front, or the one used last.
|
|
625
|
+
const target = this.focusedFullWindow();
|
|
626
|
+
if (!target) return;
|
|
627
|
+
// The bar and every form open in that window; with a popped-out pane's
|
|
628
|
+
// window in front, the keys would go there instead.
|
|
336
629
|
if (command.type === "open-command-bar" || command.type === "open-builtin-workflow" || command.type === "open-plugin-workflow") {
|
|
337
|
-
this.
|
|
630
|
+
this.windowController?.focus(target.key);
|
|
338
631
|
}
|
|
339
|
-
rpc.send["application-menu.select"]({ command });
|
|
632
|
+
target.rpc.send["application-menu.select"]({ command });
|
|
340
633
|
}
|
|
341
634
|
|
|
342
|
-
|
|
343
|
-
this.
|
|
635
|
+
quit(): void {
|
|
636
|
+
if (this.quitting) return;
|
|
637
|
+
this.quitting = true;
|
|
638
|
+
// The order a quit had with one window: the other windows close, the
|
|
639
|
+
// services stop while the main window can still hear from them, and
|
|
640
|
+
// the main window goes last.
|
|
641
|
+
this.closeAllWindows();
|
|
344
642
|
this.teardownServices();
|
|
345
|
-
|
|
346
|
-
this.mainWindow = null;
|
|
347
|
-
window?.close();
|
|
643
|
+
this.windowController?.closeWindow(MAIN_WINDOW_ID);
|
|
348
644
|
Utils.quit();
|
|
349
645
|
}
|
|
350
646
|
|
|
@@ -543,6 +839,11 @@ export class DesktopBackend {
|
|
|
543
839
|
case "desktop.dockDetachedPane":
|
|
544
840
|
case "desktop.closeDetachedPane":
|
|
545
841
|
case "desktop.focusDetachedPane":
|
|
842
|
+
case "desktop.openWindow":
|
|
843
|
+
case "desktop.moveLayoutToWindow":
|
|
844
|
+
case "desktop.movePaneToWindow":
|
|
845
|
+
case "desktop.focusWindow":
|
|
846
|
+
case "desktop.focusPane":
|
|
546
847
|
return handleDesktopWorkspaceRequest(this, rpc, request);
|
|
547
848
|
case "pluginState.setMany":
|
|
548
849
|
case "pluginState.delete":
|