Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

feat(desktop): wire custom maximize into window chrome header

Richie McIlroy32eaddc36c0d
diff --git a/apps/desktop/src/routes/(window-chrome).tsx b/apps/desktop/src/routes/(window-chrome).tsx
index 42ee74d04..8bb12b3c1 100644
--- a/apps/desktop/src/routes/(window-chrome).tsx
+++ b/apps/desktop/src/routes/(window-chrome).tsx
@@ -116,12 +116,20 @@ function Header() {
data-tauri-drag-region
>
{ctx.state()?.items}
- {isWindows && <CaptionControlsWindows11 class="ml-auto!" />}
+ {isWindows && (
+ <CaptionControlsWindows11
+ class="ml-auto!"
+ maximizable={ctx.state()?.onMaximize ? true : undefined}
+ maximized={ctx.state()?.maximized}
+ onMaximize={ctx.state()?.onMaximize}
+ />
+ )}
{((isMacOS && !isSettings()) || isLinux) && (
<CaptionControlsMacOS
class="mr-auto! ml-3"
showMinimize={false}
- showZoom={false}
+ showZoom={ctx.state()?.onMaximize !== undefined}
+ onZoom={ctx.state()?.onMaximize}
/>
)}
</header>
@@ -129,15 +137,10 @@ function Header() {
}
function Inner(props: ParentProps) {
+ const location = useLocation();
+
onMount(() => {
- const initialTargetMode = (
- window as typeof window & {
- __CAP__?: { initialTargetMode?: unknown };
- }
- ).__CAP__?.initialTargetMode;
-
- if (location.pathname !== "/" || !initialTargetMode)
- void getCurrentWindow().show();
+ if (location.pathname !== "/") void getCurrentWindow().show();
});
return (