gloomberb 0.19.4 → 0.19.6
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/package.json +3 -1
- package/patches/@opentui%2Fcore@0.3.2.patch +86 -25
- package/src/api-client/equity-screener.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.tsx +63 -16
- package/src/cli/commands/command-utils.ts +4 -0
- package/src/cli/commands/market.ts +264 -33
- package/src/cli/commands/search.ts +22 -4
- package/src/cli/commands/ticker.ts +84 -39
- package/src/cli/currency-name-hint.ts +60 -0
- package/src/cli/glossary.ts +3 -3
- package/src/cli/history-rows.ts +18 -1
- package/src/cli/known-gaps.ts +25 -2
- package/src/cli/listing-arg.ts +12 -0
- package/src/cli/not-a-ticker.ts +5 -3
- package/src/cli/pane-functions/capabilities.ts +2 -0
- package/src/cli/pane-functions/catalog.ts +31 -5
- package/src/cli/pane-functions/function-help.ts +8 -5
- package/src/cli/pane-functions/headless.ts +11 -6
- package/src/cli/pane-functions/market-session.ts +6 -7
- package/src/cli/pane-functions/resolver.ts +75 -2
- package/src/cli/quote-answer.ts +9 -0
- package/src/cli/series-search.ts +4 -5
- 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-bitmap.ts +28 -2
- 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 +30 -7
- 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 +32 -12
- 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/layout/shell/active-drag.ts +38 -7
- package/src/components/layout/shell/drag/magnets.ts +106 -0
- package/src/components/layout/shell/menu.ts +15 -1
- package/src/components/layout/shell/pane/actions.ts +4 -0
- package/src/components/layout/shell/ticker-link-menu.ts +12 -3
- package/src/components/layout/status-bar.tsx +20 -0
- package/src/components/layout/window-controls.tsx +96 -35
- package/src/components/layout/window-fullscreen.ts +20 -0
- 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 +8 -5
- package/src/components/onboarding/use-onboarding-progress.ts +20 -1
- package/src/components/price-sparkline/view.tsx +14 -6
- package/src/components/quote-flash.ts +36 -32
- 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/opentui/model.ts +4 -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 +10 -0
- package/src/i18n/ja.ts +10 -0
- package/src/i18n/ko.ts +10 -0
- package/src/i18n/zh-cn.ts +10 -0
- package/src/i18n/zh-tw.ts +10 -0
- 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/coordinator/events.ts +17 -1
- package/src/market-data/frame-scheduler.ts +47 -10
- package/src/market-data/frame-wake.ts +74 -0
- package/src/market-data/futures-board.ts +7 -6
- package/src/market-data/futures-contract.ts +14 -3
- package/src/market-data/hooks.tsx +12 -3
- package/src/market-data/market/freshness.ts +18 -0
- package/src/market-data/market/status.ts +15 -2
- package/src/market-data/performance.ts +78 -9
- package/src/market-data/request-types.ts +6 -3
- package/src/plugins/builtin/alerts/cli.ts +2 -1
- package/src/plugins/builtin/analytics/risk-evidence.ts +1 -0
- package/src/plugins/builtin/attention/evidence.ts +1 -1
- package/src/plugins/builtin/awards/client.ts +1 -1
- package/src/plugins/builtin/awards/evidence.ts +1 -1
- package/src/plugins/builtin/awards/pane.tsx +2 -1
- 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/math.ts +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/broker-manager/footer.ts +3 -2
- package/src/plugins/builtin/broker-manager/index.tsx +2 -1
- package/src/plugins/builtin/broker-manager/keyboard.ts +2 -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/catalysts/evidence.ts +1 -1
- package/src/plugins/builtin/catalysts/pane.tsx +2 -1
- package/src/plugins/builtin/cds/headless.ts +1 -0
- package/src/plugins/builtin/cds/index.tsx +1 -1
- package/src/plugins/builtin/chart-composer/headless.ts +40 -1
- package/src/plugins/builtin/cloud/plugin.tsx +2 -0
- package/src/plugins/builtin/cloud/upgrade-status-widget.tsx +28 -3
- package/src/plugins/builtin/cloud-tweets/table.tsx +3 -2
- package/src/plugins/builtin/comment-letters/client.ts +2 -1
- package/src/plugins/builtin/company-kpis/client.ts +1 -1
- package/src/plugins/builtin/company-kpis/pane.tsx +2 -1
- package/src/plugins/builtin/company-kpis/screenshot-evidence.ts +3 -2
- package/src/plugins/builtin/correlation/headless.ts +3 -2
- package/src/plugins/builtin/cot/headless.ts +9 -3
- package/src/plugins/builtin/cot/model.ts +44 -3
- package/src/plugins/builtin/credit-documents/client.ts +1 -1
- package/src/plugins/builtin/credit-documents/evidence.ts +1 -1
- package/src/plugins/builtin/credit-documents/pane.tsx +2 -1
- package/src/plugins/builtin/crypto-board/pane.tsx +5 -4
- 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-calls/pane.tsx +1 -1
- package/src/plugins/builtin/earnings-ripple/index.tsx +6 -1
- package/src/plugins/builtin/earnings-ripple/pane.tsx +1 -1
- package/src/plugins/builtin/econ/calendar-model.ts +30 -6
- package/src/plugins/builtin/econ/fred-catalog.ts +5 -5
- package/src/plugins/builtin/econ/print-watch.ts +3 -1
- package/src/plugins/builtin/equity-screener/client.ts +1 -1
- package/src/plugins/builtin/equity-screener/criterion-editor.tsx +4 -16
- package/src/plugins/builtin/equity-screener/headless.ts +4 -2
- package/src/plugins/builtin/equity-screener/ideas.ts +67 -3
- package/src/plugins/builtin/equity-screener/model.ts +180 -12
- package/src/plugins/builtin/equity-screener/pane.tsx +52 -12
- 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/futures/series.ts +16 -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/fx-matrix/headless.ts +4 -2
- package/src/plugins/builtin/fx-matrix/index.tsx +37 -3
- package/src/plugins/builtin/fx-matrix/pairs.ts +15 -0
- package/src/plugins/builtin/gpu/headless.ts +2 -1
- package/src/plugins/builtin/help/function-card.tsx +2 -1
- package/src/plugins/builtin/help/index.tsx +2 -1
- package/src/plugins/builtin/insider/display.ts +45 -6
- package/src/plugins/builtin/ipo-calendar/model.ts +2 -0
- package/src/plugins/builtin/iv-history/client.ts +2 -1
- package/src/plugins/builtin/iv-history/headless.ts +2 -1
- package/src/plugins/builtin/jobs/pages.ts +4 -4
- package/src/plugins/builtin/kelly-sizer/headless.ts +2 -1
- 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-heatmap/index.tsx +2 -1
- package/src/plugins/builtin/market-movers/index.tsx +4 -3
- package/src/plugins/builtin/members/client.ts +1 -1
- package/src/plugins/builtin/mna/distress/client.ts +1 -0
- package/src/plugins/builtin/mna/distress/headless.ts +1 -0
- package/src/plugins/builtin/mna/pane.tsx +4 -1
- package/src/plugins/builtin/options/market-reference.ts +1 -1
- package/src/plugins/builtin/options/open-interest-as-of.ts +3 -1
- package/src/plugins/builtin/options/view.tsx +2 -1
- package/src/plugins/builtin/options-calculator/evidence.ts +1 -1
- package/src/plugins/builtin/options-scenario/csp-screen-pane.tsx +1 -1
- package/src/plugins/builtin/options-scenario/csp-screen.ts +8 -4
- package/src/plugins/builtin/options-scenario/csp.ts +28 -9
- package/src/plugins/builtin/options-scenario/evidence.ts +5 -4
- package/src/plugins/builtin/options-scenario/pane.tsx +2 -1
- package/src/plugins/builtin/perps/client.ts +1 -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 +4 -2
- package/src/plugins/builtin/portfolio-list/pane/index.tsx +7 -3
- package/src/plugins/builtin/portfolio-list/use-throttled-memo.ts +10 -19
- package/src/plugins/builtin/rate-path/headless.ts +24 -10
- package/src/plugins/builtin/research/analyst-model.ts +1 -0
- package/src/plugins/builtin/research/equity-diagnostic-pane.tsx +2 -1
- package/src/plugins/builtin/research/event-model.ts +10 -3
- package/src/plugins/builtin/research/events-headless.ts +20 -2
- package/src/plugins/builtin/research/index.tsx +1 -0
- package/src/plugins/builtin/research/relative-valuation-currency.ts +1 -1
- package/src/plugins/builtin/research/relative-valuation-peers.ts +2 -1
- package/src/plugins/builtin/research-search/command-bar-search.ts +3 -1
- package/src/plugins/builtin/research-search/snippet.ts +1 -0
- package/src/plugins/builtin/revenue-breakdown/client.ts +3 -2
- package/src/plugins/builtin/seasonality/headless.ts +2 -1
- package/src/plugins/builtin/sec/command-bar-search.ts +3 -2
- package/src/plugins/builtin/sec/fund-facts.ts +17 -1
- package/src/plugins/builtin/sec/index.tsx +8 -5
- package/src/plugins/builtin/sec/row-summaries.ts +28 -12
- package/src/plugins/builtin/shared/members-menu.tsx +103 -38
- 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/watch-client.ts +2 -1
- package/src/plugins/builtin/short-interest/watch-model.ts +1 -1
- package/src/plugins/builtin/social-mentions/client.ts +2 -1
- package/src/plugins/builtin/supply-chain/client.ts +1 -1
- package/src/plugins/builtin/supply-chain/evidence.ts +1 -1
- package/src/plugins/builtin/supply-chain/graph-pane.tsx +2 -1
- package/src/plugins/builtin/supply-chain/pane.tsx +2 -1
- package/src/plugins/builtin/ticker-detail/adr-pair/headless.ts +1 -1
- package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +24 -4
- package/src/plugins/builtin/ticker-detail/adr-pair/tab.tsx +1 -1
- package/src/plugins/builtin/time-sales/client.ts +1 -0
- 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/index.tsx +1 -1
- package/src/plugins/builtin/vol-surface/client.ts +2 -1
- 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 +9 -2
- 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/portfolio/collection-name.ts +19 -0
- package/src/portfolio/column-values.ts +76 -10
- package/src/renderers/browser/http-proxy-transport.ts +78 -8
- package/src/renderers/cloudflare/http-proxy.ts +13 -2
- package/src/renderers/cloudflare/proxy-session.ts +47 -24
- package/src/renderers/cloudflare/worker.ts +15 -2
- 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/host/box.tsx +204 -176
- package/src/renderers/dom/host/style.ts +49 -20
- package/src/renderers/dom/host/text.tsx +3 -2
- 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 +322 -19
- package/src/renderers/electrobun/bun/desktop/detached-windows.ts +83 -61
- package/src/renderers/electrobun/bun/desktop/host-requests.ts +29 -15
- package/src/renderers/electrobun/bun/desktop/initialization.ts +30 -11
- package/src/renderers/electrobun/bun/desktop/relaunch.ts +9 -1
- 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/windows-script.ts +9 -6
- 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 +4 -97
- package/src/renderers/electrobun/bun/window/electrobun-window-host.ts +306 -0
- package/src/renderers/electrobun/bun/window/focus.ts +0 -25
- package/src/renderers/electrobun/bun/window/remembered-frame.ts +4 -82
- package/src/renderers/electrobun/bun/window/windows-native.ts +26 -1
- package/src/renderers/electrobun/shared/protocol.ts +50 -2
- package/src/renderers/electrobun/view/backend-rpc.ts +15 -0
- package/src/renderers/electrobun/view/desktop/window/bridge.ts +63 -3
- package/src/renderers/electrobun/view/main.tsx +13 -7
- package/src/renderers/electrobun/view/ui-host.tsx +7 -0
- package/src/renderers/electrobun/view/window-fullscreen.ts +10 -3
- package/src/series/fred-argument.ts +17 -0
- package/src/sources/provider-router/financial-routes.ts +7 -1
- package/src/sources/provider-router/index.ts +7 -1
- 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/price-units.ts +11 -0
- package/src/time-series/types.ts +6 -0
- package/src/types/config.ts +10 -1
- package/src/types/desktop-window.ts +71 -2
- package/src/types/financials.ts +4 -0
- package/src/types/headless.ts +19 -0
- package/src/types/plugin.ts +6 -0
- package/src/ui/host.tsx +2 -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/currency-names.ts +20 -0
- package/src/utils/currency-pair.ts +6 -0
- package/src/utils/exchange-rate-snapshot.ts +20 -2
- package/src/utils/format.ts +7 -2
- package/src/utils/futures-generic.ts +12 -0
- package/src/utils/fx-market-hours.ts +43 -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/sec-filings.ts +7 -1
|
@@ -5,12 +5,13 @@ import type {
|
|
|
5
5
|
DesktopBackendRequestResponse,
|
|
6
6
|
DesktopHostRequest,
|
|
7
7
|
DesktopWindowControlAction,
|
|
8
|
+
DesktopWindowResizeEdge,
|
|
8
9
|
} from "../../shared/protocol";
|
|
9
10
|
import { safeExternalUrl } from "../../../../utils/external-url";
|
|
10
11
|
import { getContextMenuRequestId, normalizeContextMenuItems } from "../context-menu/normalize";
|
|
11
12
|
import { MAIN_WINDOW_RPC_KEY } from "../window/focus";
|
|
12
13
|
import { applyDesktopWindowControl } from "../window/controls";
|
|
13
|
-
import { startSystemWindowMove } from "../window/windows-native";
|
|
14
|
+
import { startSystemWindowMove, startSystemWindowResize } from "../window/windows-native";
|
|
14
15
|
import { saveTextFileToDownloads } from "../../../../utils/save-text-file";
|
|
15
16
|
import { setAppBadge } from "./app-badge";
|
|
16
17
|
import { desktopBootFramePath, saveDesktopBootFrame } from "../window/boot-frame";
|
|
@@ -37,9 +38,7 @@ function playNotificationSound(sound: string | undefined): void {
|
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
function windowForRpcKey(backend: DesktopBackend, windowKey: string | undefined): BrowserWindow | null {
|
|
40
|
-
return windowKey
|
|
41
|
-
? backend.mainWindow
|
|
42
|
-
: backend.detachedWindows.getWindowForRpcKey(windowKey);
|
|
41
|
+
return backend.nativeWindow(windowKey);
|
|
43
42
|
}
|
|
44
43
|
|
|
45
44
|
/**
|
|
@@ -55,6 +54,14 @@ function isWindowFullscreen(backend: DesktopBackend, windowKey: string | undefin
|
|
|
55
54
|
}
|
|
56
55
|
}
|
|
57
56
|
|
|
57
|
+
function isWindowMaximized(backend: DesktopBackend, windowKey: string | undefined): boolean {
|
|
58
|
+
try {
|
|
59
|
+
return windowForRpcKey(backend, windowKey)?.isMaximized?.() === true;
|
|
60
|
+
} catch {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
58
65
|
function controlWindow(
|
|
59
66
|
backend: DesktopBackend,
|
|
60
67
|
windowKey: string | undefined,
|
|
@@ -69,17 +76,14 @@ function controlWindow(
|
|
|
69
76
|
return true;
|
|
70
77
|
}
|
|
71
78
|
|
|
72
|
-
/** Exiting closes
|
|
79
|
+
/** Exiting closes every window and the services, then quits. */
|
|
73
80
|
function exitDesktopApp(backend: DesktopBackend): void {
|
|
74
|
-
backend.
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
Utils.quit();
|
|
81
|
+
backend.quit();
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function normalizeWindowResizeEdge(edge: unknown): DesktopWindowResizeEdge {
|
|
85
|
+
if (edge === "top" || edge === "top-left" || edge === "top-right") return edge;
|
|
86
|
+
throw new Error("host.startWindowResize requires a top edge or corner.");
|
|
83
87
|
}
|
|
84
88
|
|
|
85
89
|
function normalizeWindowControlAction(action: unknown): DesktopWindowControlAction {
|
|
@@ -112,6 +116,8 @@ export async function handleDesktopHostRequest(
|
|
|
112
116
|
}
|
|
113
117
|
case "host.windowFullscreen":
|
|
114
118
|
return isWindowFullscreen(backend, backend.rpcs.getRpcWindowKey(rpc));
|
|
119
|
+
case "host.windowMaximized":
|
|
120
|
+
return isWindowMaximized(backend, backend.rpcs.getRpcWindowKey(rpc));
|
|
115
121
|
case "host.startWindowDrag": {
|
|
116
122
|
const targetWindow = windowForRpcKey(backend, backend.rpcs.getRpcWindowKey(rpc));
|
|
117
123
|
if (!targetWindow?.ptr || !startSystemWindowMove(targetWindow.ptr)) {
|
|
@@ -119,6 +125,14 @@ export async function handleDesktopHostRequest(
|
|
|
119
125
|
}
|
|
120
126
|
return null;
|
|
121
127
|
}
|
|
128
|
+
case "host.startWindowResize": {
|
|
129
|
+
const edge = normalizeWindowResizeEdge(request.payload.edge);
|
|
130
|
+
const targetWindow = windowForRpcKey(backend, backend.rpcs.getRpcWindowKey(rpc));
|
|
131
|
+
if (!targetWindow?.ptr || !startSystemWindowResize(targetWindow.ptr, edge)) {
|
|
132
|
+
throw new Error("This window cannot be resized by the system.");
|
|
133
|
+
}
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
122
136
|
case "host.openExternal": {
|
|
123
137
|
if (typeof request.payload.url !== "string") {
|
|
124
138
|
throw new Error("host.openExternal requires a URL.");
|
|
@@ -131,7 +145,7 @@ export async function handleDesktopHostRequest(
|
|
|
131
145
|
return null;
|
|
132
146
|
case "host.focusWindow": {
|
|
133
147
|
const windowKey = backend.rpcs.getRpcWindowKey(rpc);
|
|
134
|
-
|
|
148
|
+
backend.focusWindow(windowKey);
|
|
135
149
|
return null;
|
|
136
150
|
}
|
|
137
151
|
case "host.copyPngImage": {
|
|
@@ -31,13 +31,15 @@ import { markStartupComplete } from "../../../../utils/main-thread-stall";
|
|
|
31
31
|
interface DesktopWindowTarget {
|
|
32
32
|
kind: "main" | "detached";
|
|
33
33
|
paneId?: string;
|
|
34
|
+
/** A full window's id: the main window's, or an extra window's. */
|
|
35
|
+
windowId?: string;
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
function normalizeInitWindowTarget(
|
|
37
39
|
rpcKey: string | undefined,
|
|
38
40
|
payload: DesktopBackendRequestPayload<"init">,
|
|
39
41
|
): DesktopWindowTarget {
|
|
40
|
-
if (rpcKey === MAIN_WINDOW_RPC_KEY) return { kind: "main" };
|
|
42
|
+
if (rpcKey === MAIN_WINDOW_RPC_KEY) return { kind: "main", windowId: MAIN_WINDOW_RPC_KEY };
|
|
41
43
|
|
|
42
44
|
const detachedPaneId = paneIdFromDetachedRpcKey(rpcKey);
|
|
43
45
|
if (detachedPaneId) {
|
|
@@ -46,6 +48,8 @@ function normalizeInitWindowTarget(
|
|
|
46
48
|
paneId: detachedPaneId,
|
|
47
49
|
};
|
|
48
50
|
}
|
|
51
|
+
// Every other window the backend opens is a full window with its own tabs.
|
|
52
|
+
if (rpcKey) return { kind: "main", windowId: rpcKey };
|
|
49
53
|
|
|
50
54
|
const kind = payload.kind === "detached" ? "detached" : "main";
|
|
51
55
|
return {
|
|
@@ -75,13 +79,21 @@ function buildInitializationPayload(
|
|
|
75
79
|
config: AppConfig,
|
|
76
80
|
services: AppServices,
|
|
77
81
|
windowTarget: DesktopWindowTarget,
|
|
82
|
+
windowKey: string | undefined,
|
|
78
83
|
): ElectrobunBackendInit {
|
|
84
|
+
const mainWindow = windowTarget.windowId === MAIN_WINDOW_RPC_KEY;
|
|
79
85
|
// The main window says once what the launch's seed could not install.
|
|
80
|
-
const pluginSeedNotice =
|
|
86
|
+
const pluginSeedNotice = mainWindow ? takePluginSeedNotice() : null;
|
|
87
|
+
// Each full window draws its own tabs; a popped-out pane's draws the main
|
|
88
|
+
// window's. Numbered like every state sent, so the window's first sync is
|
|
89
|
+
// merged against it.
|
|
90
|
+
const projected = backend.workspace?.getWindowSnapshot(windowTarget.windowId ?? MAIN_WINDOW_RPC_KEY) ?? null;
|
|
91
|
+
const desktopSnapshot = projected ? backend.stateBroadcaster.stamp(projected) : null;
|
|
92
|
+
if (desktopSnapshot && windowKey) backend.workspace?.noteDelivered(windowKey, desktopSnapshot.stateSeq!, desktopSnapshot);
|
|
81
93
|
return {
|
|
82
|
-
config,
|
|
94
|
+
config: desktopSnapshot?.config ?? config,
|
|
83
95
|
sessionSnapshot: backend.getSessionSnapshot(),
|
|
84
|
-
desktopSnapshot
|
|
96
|
+
desktopSnapshot,
|
|
85
97
|
desktopThemePreview: backend.stateBroadcaster.currentThemePreview,
|
|
86
98
|
pluginState: loadDesktopPluginState(services.pluginRegistry),
|
|
87
99
|
savedResources: loadSavedResources(services, config),
|
|
@@ -90,6 +102,8 @@ function buildInitializationPayload(
|
|
|
90
102
|
hostName: hostname(),
|
|
91
103
|
windowKind: windowTarget.kind,
|
|
92
104
|
paneId: windowTarget.paneId,
|
|
105
|
+
...(windowTarget.windowId ? { windowId: windowTarget.windowId, windows: backend.windowInfos() } : {}),
|
|
106
|
+
...(mainWindow ? { otherWindowTabs: backend.otherWindowTabsForInit() } : {}),
|
|
93
107
|
...(pluginSeedNotice ? { pluginSeedNotice } : {}),
|
|
94
108
|
telemetry: {
|
|
95
109
|
installId: readOrCreateInstallId(config.dataDir),
|
|
@@ -185,23 +199,28 @@ export async function initializeDesktopBackend(
|
|
|
185
199
|
rpc: DesktopRpc,
|
|
186
200
|
payload: DesktopBackendRequestPayload<"init">,
|
|
187
201
|
): Promise<ElectrobunBackendInit> {
|
|
188
|
-
const
|
|
202
|
+
const windowKey = backend.rpcs.getRpcWindowKey(rpc);
|
|
203
|
+
const windowTarget = normalizeInitWindowTarget(windowKey, payload);
|
|
189
204
|
backend.rpcs.markWindowRpcReady(rpc);
|
|
190
205
|
backend.stateBroadcaster.forgetWindowState(rpc);
|
|
206
|
+
// Its page loaded and runs: the next window waiting to open may.
|
|
207
|
+
if (windowKey) backend.windowHost?.windowDrawn(windowKey);
|
|
191
208
|
|
|
192
209
|
await startDesktopBackend(backend);
|
|
193
210
|
const config = backend.requireConfig();
|
|
194
211
|
const services = backend.requireServices();
|
|
195
212
|
if (!backend.workspace) {
|
|
196
|
-
backend.workspace = createDesktopWorkspace(config, backend.getSessionSnapshot());
|
|
197
|
-
backend.
|
|
213
|
+
backend.workspace = createDesktopWorkspace(config, backend.getSessionSnapshot(), backend.windowController?.screenSetup.windows);
|
|
214
|
+
backend.reconcileWindows();
|
|
198
215
|
}
|
|
199
|
-
|
|
216
|
+
// A window that loads again starts from this state: nothing sent before counts.
|
|
217
|
+
if (windowKey) backend.workspace.forgetWindow(windowKey);
|
|
218
|
+
const init = buildInitializationPayload(backend, config, services, windowTarget, windowKey);
|
|
200
219
|
// The main window has what it needs to draw: this process is up, and the
|
|
201
|
-
// popped-out windows open next.
|
|
202
|
-
if (windowTarget.
|
|
220
|
+
// popped-out panes and extra windows open next.
|
|
221
|
+
if (windowTarget.windowId === MAIN_WINDOW_RPC_KEY) {
|
|
203
222
|
markStartupComplete();
|
|
204
|
-
backend.
|
|
223
|
+
backend.openWindowsAfterMainWindow();
|
|
205
224
|
}
|
|
206
225
|
return init;
|
|
207
226
|
}
|
|
@@ -144,6 +144,14 @@ try {
|
|
|
144
144
|
].join("\n");
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
+
/**
|
|
148
|
+
* How long a restart waits for its script, with the error screen saying the
|
|
149
|
+
* restart was asked. Windows PowerShell started by the Task Scheduler can take
|
|
150
|
+
* over 20 s to run its first line: 23 s on an idle Windows on Arm machine,
|
|
151
|
+
* over a minute on a busy one, where a task runs below normal priority.
|
|
152
|
+
*/
|
|
153
|
+
const RESTART_SCRIPT_START_TIMEOUT_MS = 120_000;
|
|
154
|
+
|
|
147
155
|
/**
|
|
148
156
|
* Electrobun puts the Windows app in a job that ends every process it starts
|
|
149
157
|
* when it exits, so the script runs from a scheduled task, which outlives it.
|
|
@@ -164,7 +172,7 @@ async function scheduleWindowsRelaunch(context: RelaunchContext): Promise<void>
|
|
|
164
172
|
taskName: `GloomRestart-${context.pid}`,
|
|
165
173
|
home: context.home,
|
|
166
174
|
}));
|
|
167
|
-
const answer = await runScriptAfterExit(script, log, cancel, `GloomRestart-${context.pid}
|
|
175
|
+
const answer = await runScriptAfterExit(script, log, cancel, `GloomRestart-${context.pid}`, RESTART_SCRIPT_START_TIMEOUT_MS);
|
|
168
176
|
if (answer.kind !== "started") throw new Error(`the restart script did not start: ${answer.reason}`);
|
|
169
177
|
}
|
|
170
178
|
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { copyFileSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "fs";
|
|
2
|
+
import { dirname, join } from "path";
|
|
3
|
+
import { getGloomberbDirs } from "../../../../data/config/home";
|
|
4
|
+
import { emptyScreenSetup, parseScreenSetup, type ScreenSetup } from "../../../desktop/screen-setup";
|
|
5
|
+
import type { ScreenSetupStore } from "../../../desktop/window-controller";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The windows and where they sit, per monitor arrangement, beside the config
|
|
9
|
+
* and never in it: launch reads it before the config, and it describes this
|
|
10
|
+
* machine's screens, so it stays out of the synced config.
|
|
11
|
+
*/
|
|
12
|
+
const FILE_NAME = "desktop-windows.json";
|
|
13
|
+
|
|
14
|
+
function desktopScreenSetupPath(env: NodeJS.ProcessEnv = process.env): string {
|
|
15
|
+
return join(dirname(getGloomberbDirs(env).configFile), FILE_NAME);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function desktopScreenSetupStore(path: string = desktopScreenSetupPath()): ScreenSetupStore {
|
|
19
|
+
return {
|
|
20
|
+
load(): ScreenSetup {
|
|
21
|
+
let text: string;
|
|
22
|
+
try {
|
|
23
|
+
text = readFileSync(path, "utf8");
|
|
24
|
+
} catch {
|
|
25
|
+
// Intentional ignore: no file yet; the windows start from the defaults.
|
|
26
|
+
return emptyScreenSetup();
|
|
27
|
+
}
|
|
28
|
+
try {
|
|
29
|
+
const raw: unknown = JSON.parse(text);
|
|
30
|
+
if (raw && typeof raw === "object" && !Array.isArray(raw)) return parseScreenSetup(raw);
|
|
31
|
+
} catch {
|
|
32
|
+
// Not JSON: kept below.
|
|
33
|
+
}
|
|
34
|
+
// The next save would replace a file this build cannot read: a copy stays beside it.
|
|
35
|
+
try {
|
|
36
|
+
copyFileSync(path, `${path}.bak`);
|
|
37
|
+
} catch {
|
|
38
|
+
// Intentional ignore: the windows start from the defaults either way.
|
|
39
|
+
}
|
|
40
|
+
console.error("[desktop] the window setup could not be read; a copy was kept as desktop-windows.json.bak");
|
|
41
|
+
return emptyScreenSetup();
|
|
42
|
+
},
|
|
43
|
+
save(setup: ScreenSetup): void {
|
|
44
|
+
const temporary = `${path}.${process.pid}.tmp`;
|
|
45
|
+
try {
|
|
46
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
47
|
+
writeFileSync(temporary, JSON.stringify(setup));
|
|
48
|
+
renameSync(temporary, path);
|
|
49
|
+
} catch (error) {
|
|
50
|
+
rmSync(temporary, { force: true });
|
|
51
|
+
console.error("[desktop] could not save the window setup", error instanceof Error ? error.message : String(error));
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
}
|
|
@@ -15,6 +15,21 @@ export interface DesktopStateRpc {
|
|
|
15
15
|
|
|
16
16
|
interface DesktopStateBroadcasterOptions<Rpc extends DesktopStateRpc> {
|
|
17
17
|
forEachReadyWindowRpc: (callback: (rpc: Rpc) => void) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Which state a window draws: windows with the same view share one key.
|
|
20
|
+
* Without it every window gets the shared state.
|
|
21
|
+
*/
|
|
22
|
+
viewKey?: (rpc: Rpc) => string;
|
|
23
|
+
/** The state for a view key, from the shared one; null sends that window nothing. */
|
|
24
|
+
project?: (viewKey: string, shared: DesktopSharedStateSnapshot) => DesktopSharedStateSnapshot | null;
|
|
25
|
+
/** Each state sent to a window, with the number it carries, which the window's next sync names as its base. */
|
|
26
|
+
delivered?: (rpc: Rpc, snapshot: DesktopSharedStateSnapshot) => void;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface ProjectedState {
|
|
30
|
+
snapshot: DesktopSharedStateSnapshot | null;
|
|
31
|
+
key?: string;
|
|
32
|
+
encoded?: DesktopSharedStateSnapshot;
|
|
18
33
|
}
|
|
19
34
|
|
|
20
35
|
/**
|
|
@@ -29,6 +44,7 @@ function desktopStateKey(snapshot: DesktopSharedStateSnapshot): string {
|
|
|
29
44
|
focusedPaneId: snapshot.focusedPaneId,
|
|
30
45
|
statusBarVisible: snapshot.statusBarVisible,
|
|
31
46
|
brokerSyncErrors: snapshot.brokerSyncErrors ?? {},
|
|
47
|
+
linkedTickers: snapshot.linkedTickers ?? {},
|
|
32
48
|
});
|
|
33
49
|
}
|
|
34
50
|
|
|
@@ -37,6 +53,7 @@ export class DesktopStateBroadcaster<Rpc extends DesktopStateRpc> {
|
|
|
37
53
|
private themePreview: DesktopThemePreviewState = { theme: null };
|
|
38
54
|
/** The state held by each window that sends its whole state: what it last sent here or was sent. */
|
|
39
55
|
private readonly heldStateKeys = new WeakMap<Rpc, string>();
|
|
56
|
+
private seq = 0;
|
|
40
57
|
|
|
41
58
|
constructor(private readonly options: DesktopStateBroadcasterOptions<Rpc>) {}
|
|
42
59
|
|
|
@@ -52,6 +69,12 @@ export class DesktopStateBroadcaster<Rpc extends DesktopStateRpc> {
|
|
|
52
69
|
this.dockPreview = { paneId: null, edge: null };
|
|
53
70
|
}
|
|
54
71
|
|
|
72
|
+
/** Numbers a state handed to a window outside a broadcast (its `init`), in the same series. */
|
|
73
|
+
stamp(snapshot: DesktopSharedStateSnapshot): DesktopSharedStateSnapshot {
|
|
74
|
+
this.seq += 1;
|
|
75
|
+
return { ...snapshot, stateSeq: this.seq };
|
|
76
|
+
}
|
|
77
|
+
|
|
55
78
|
/** A window that sent its whole state holds it, and is not sent it back. */
|
|
56
79
|
noteWindowState(rpc: Rpc, snapshot: DesktopSharedStateSnapshot): void {
|
|
57
80
|
this.heldStateKeys.set(rpc, desktopStateKey(snapshot));
|
|
@@ -72,18 +95,29 @@ export class DesktopStateBroadcaster<Rpc extends DesktopStateRpc> {
|
|
|
72
95
|
*/
|
|
73
96
|
sendDesktopState(snapshot: DesktopSharedStateSnapshot | null): void {
|
|
74
97
|
if (!snapshot) return;
|
|
75
|
-
|
|
76
|
-
|
|
98
|
+
this.seq += 1;
|
|
99
|
+
const seq = this.seq;
|
|
100
|
+
const views = new Map<string, ProjectedState>();
|
|
101
|
+
const { viewKey, project, delivered } = this.options;
|
|
77
102
|
this.options.forEachReadyWindowRpc((rpc) => {
|
|
103
|
+
const view = viewKey?.(rpc) ?? "";
|
|
104
|
+
let projected = views.get(view);
|
|
105
|
+
if (!projected) {
|
|
106
|
+
const shown = project ? project(view, snapshot) : snapshot;
|
|
107
|
+
projected = { snapshot: shown ? { ...shown, stateSeq: seq } : null };
|
|
108
|
+
views.set(view, projected);
|
|
109
|
+
}
|
|
110
|
+
if (!projected.snapshot) return;
|
|
78
111
|
const heldKey = this.heldStateKeys.get(rpc);
|
|
79
112
|
if (heldKey !== undefined) {
|
|
80
|
-
|
|
81
|
-
if (heldKey ===
|
|
82
|
-
this.heldStateKeys.set(rpc,
|
|
113
|
+
projected.key ??= desktopStateKey(projected.snapshot);
|
|
114
|
+
if (heldKey === projected.key) return;
|
|
115
|
+
this.heldStateKeys.set(rpc, projected.key);
|
|
83
116
|
}
|
|
84
|
-
|
|
117
|
+
projected.encoded ??= encodeRpcValue(projected.snapshot) as DesktopSharedStateSnapshot;
|
|
118
|
+
delivered?.(rpc, projected.snapshot);
|
|
85
119
|
rpc.send["desktop.state"]({
|
|
86
|
-
snapshot:
|
|
120
|
+
snapshot: projected.encoded,
|
|
87
121
|
});
|
|
88
122
|
});
|
|
89
123
|
}
|
|
@@ -101,11 +135,13 @@ export class DesktopStateBroadcaster<Rpc extends DesktopStateRpc> {
|
|
|
101
135
|
});
|
|
102
136
|
}
|
|
103
137
|
|
|
104
|
-
|
|
138
|
+
/** Every window but the one previewing (`fromRpc`) previews the theme too. */
|
|
139
|
+
sendThemePreview(preview: DesktopThemePreviewState, fromRpc?: Rpc): void {
|
|
105
140
|
if (this.themePreview.theme === preview.theme) return;
|
|
106
141
|
this.themePreview = preview;
|
|
107
142
|
const encodedPreview = encodeRpcValue(preview) as DesktopThemePreviewState;
|
|
108
143
|
this.options.forEachReadyWindowRpc((rpc) => {
|
|
144
|
+
if (rpc === fromRpc) return;
|
|
109
145
|
rpc.send["desktop.themePreview"]({
|
|
110
146
|
preview: encodedPreview,
|
|
111
147
|
});
|
|
@@ -5,7 +5,10 @@ import { readFile, writeFile } from "fs/promises";
|
|
|
5
5
|
* it runs: its own files are locked until it quits.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* How long a script has, by default, to answer before the app stops waiting
|
|
10
|
+
* and keeps running. The app may still be opening: no window shows until then.
|
|
11
|
+
*/
|
|
9
12
|
const SCRIPT_START_TIMEOUT_MS = 20_000;
|
|
10
13
|
|
|
11
14
|
/**
|
|
@@ -62,16 +65,16 @@ function schtasks(...args: string[]): void {
|
|
|
62
65
|
* Runs `script` from the scheduled task `taskName`, which outlives the app (a
|
|
63
66
|
* child of its process dies with it), and resolves to the answer it writes to
|
|
64
67
|
* `log`: only on `started` may the app quit for it. The script removes the
|
|
65
|
-
* task. When it does not answer
|
|
66
|
-
* a script that starts late from doing anything, and this throws
|
|
67
|
-
* task gone, as it does when the task could not be made.
|
|
68
|
+
* task. When it does not answer within `timeoutMs`, the app writes `cancel`,
|
|
69
|
+
* which keeps a script that starts late from doing anything, and this throws
|
|
70
|
+
* with the task gone, as it does when the task could not be made.
|
|
68
71
|
*/
|
|
69
|
-
export async function runScriptAfterExit(script: string, log: string, cancel: string, taskName: string): Promise<ScriptAnswer> {
|
|
72
|
+
export async function runScriptAfterExit(script: string, log: string, cancel: string, taskName: string, timeoutMs = SCRIPT_START_TIMEOUT_MS): Promise<ScriptAnswer> {
|
|
70
73
|
const command = powershellCommand(script).map((part) => (part === script ? `"${part}"` : part)).join(" ");
|
|
71
74
|
try {
|
|
72
75
|
schtasks("/create", "/tn", taskName, "/tr", command, "/sc", "once", "/st", "00:00", "/f");
|
|
73
76
|
schtasks("/run", "/tn", taskName);
|
|
74
|
-
const deadline = Date.now() +
|
|
77
|
+
const deadline = Date.now() + timeoutMs;
|
|
75
78
|
while (Date.now() < deadline) {
|
|
76
79
|
const answer = scriptAnswer(await readFile(log, "utf8").catch(() => ""));
|
|
77
80
|
if (answer) return answer;
|