Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

feat(desktop): add onZoom callback to macOS caption controls

Richie McIlroy6dd48f37978f
diff --git a/apps/desktop/src/components/titlebar/controls/CaptionControlsMacOS.tsx b/apps/desktop/src/components/titlebar/controls/CaptionControlsMacOS.tsx
index dd745fe0a..dbbbede8e 100644
--- a/apps/desktop/src/components/titlebar/controls/CaptionControlsMacOS.tsx
+++ b/apps/desktop/src/components/titlebar/controls/CaptionControlsMacOS.tsx
@@ -10,12 +10,17 @@ import {
} from "solid-js";
export default function CaptionControlsMacOS(
- props: ComponentProps<"div"> & { showMinimize?: boolean; showZoom?: boolean },
+ props: ComponentProps<"div"> & {
+ showMinimize?: boolean;
+ showZoom?: boolean;
+ onZoom?: () => void;
+ },
) {
const [local, otherProps] = splitProps(props, [
"class",
"showMinimize",
"showZoom",
+ "onZoom",
]);
const currentWindow = getCurrentWindow();
const [focused, setFocus] = createSignal(true);
@@ -65,7 +70,10 @@ export default function CaptionControlsMacOS(
type="zoom"
focused={focused()}
hovered={hovered()}
- onClick={() => currentWindow.toggleMaximize()}
+ onClick={() => {
+ if (local.onZoom) local.onZoom();
+ else void currentWindow.toggleMaximize();
+ }}
/>
</Show>
</div>