Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
Enable global shortcuts to control all side panels (#4553)
Jacob Beckerman69dec0a6eb2c
diff --git a/js/app/packages/app/component/app-sidebar/sidebar.tsx b/js/app/packages/app/component/app-sidebar/sidebar.tsxindex a1c39c8e0f..c02133622b 100644--- a/js/app/packages/app/component/app-sidebar/sidebar.tsx+++ b/js/app/packages/app/component/app-sidebar/sidebar.tsx@@ -20,6 +20,7 @@ import {requestInboxFilter,} from '@app/component/next-soup/soup-view/inbox-filter-controllers';import { requestSearchFocus } from '@app/component/next-soup/soup-view/search-controllers';+import { setAllSidePanelsOpen } from '@app/component/side-panel/registry';import { useSplitLayout } from '@app/component/split-layout/layout';import type {ReferredFrom,@@ -422,11 +423,13 @@ const registerSidebarHotkeys = ({hotkey: 'cmd+.',scopeId: 'global',hotkeyToken: TOKENS.global.toggleSidebar,- description: 'Toggle sidebar',+ description: 'Toggle sidebar and side panels',runWithInputFocused: true,keyDownHandler: (e) => {e?.preventDefault();- onOpenChange(isSlim());+ const show = isSlim();+ onOpenChange(show);+ setAllSidePanelsOpen(show);return true;},});diff --git a/js/app/packages/app/component/side-panel/SidePanel.tsx b/js/app/packages/app/component/side-panel/SidePanel.tsxindex 91fc2d3736..115805c53e 100644--- a/js/app/packages/app/component/side-panel/SidePanel.tsx+++ b/js/app/packages/app/component/side-panel/SidePanel.tsx@@ -32,6 +32,7 @@ import {type SidePanelContextType,type SidePanelSectionEntry,} from './context';+import { registerSidePanelInstance } from './registry';const NARROW_THRESHOLD_PX = 1224;const SIDE_MIN_PX = 320;@@ -73,6 +74,10 @@ function Layout(props: ParentProps) {};const toggle = () => setIsOpen((prev) => !prev);+ // Let global chrome shortcuts (cmd+.) hide/show this panel alongside the+ // app sidebar.+ onCleanup(registerSidePanelInstance({ setIsOpen, isNarrow }));+const register = (entry: SidePanelSectionEntry) => {setSections((prev) => {const next = prev.filter((s) => s.id !== entry.id);diff --git a/js/app/packages/app/component/side-panel/registry.ts b/js/app/packages/app/component/side-panel/registry.tsnew file mode 100644index 0000000000..3c4f3da9aa--- /dev/null+++ b/js/app/packages/app/component/side-panel/registry.ts@@ -0,0 +1,31 @@+/**+ * Module-level registry of mounted SidePanel layouts so global chrome+ * shortcuts (e.g. cmd+. "toggle sidebar") can show/hide every right-hand+ * side panel, not just the panel owned by the focused split.+ */++type SidePanelInstance = {+ setIsOpen: (open: boolean) => void;+ isNarrow: () => boolean;+};++const instances = new Set<SidePanelInstance>();++/** Register a mounted side panel. Returns a disposer. */+export function registerSidePanelInstance(instance: SidePanelInstance) {+ instances.add(instance);+ return () => {+ instances.delete(instance);+ };+}++/**+ * Show/hide every mounted side panel. Narrow layouts render the panel as a+ * full-screen overlay, so they are only ever hidden — never force-opened.+ */+export function setAllSidePanelsOpen(open: boolean) {+ for (const instance of instances) {+ if (open && instance.isNarrow()) continue;+ instance.setIsOpen(open);+ }+}