Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/desktop/src/window/DesktopWindow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ export const make = Effect.gen(function* () {
runFork(flushBoundsPersist);
});

if (environment.platform === "darwin") {
if (environment.platform === "darwin" || environment.platform === "win32") {
window.on("enter-full-screen", () => {
window.webContents.send(WINDOW_FULLSCREEN_STATE_CHANNEL, true);
});
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/DiffPanelShell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function getDiffPanelHeaderRowClassName(mode: DiffPanelMode) {
"flex items-center justify-between gap-2",
mode === "embedded" ? "px-2" : "px-4",
shouldUseDragRegion
? "drag-region h-[52px] border-b border-border wco:h-[env(titlebar-area-height)] wco:pr-[calc(100vw-env(titlebar-area-width)-env(titlebar-area-x)+1em)]"
? "workspace-topbar drag-region border-b border-border wco:pr-[var(--workspace-native-controls-inset)]"
: "surface-subheader",
);
}
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/settings/ProjectSettingsPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ export function ProjectSettingsPage({ projectKey }: { projectKey: string }) {
{isElectron && (
<div
className={cn(
"drag-region flex h-[52px] shrink-0 items-center px-5 transition-[padding-left] duration-200 ease-linear motion-reduce:transition-none wco:h-[env(titlebar-area-height)] wco:pr-[calc(100vw-env(titlebar-area-width)-env(titlebar-area-x)+1em)]",
"workspace-topbar drag-region px-5 transition-[padding-left] duration-200 ease-linear motion-reduce:transition-none wco:pr-[var(--workspace-native-controls-inset)]",
COLLAPSED_SIDEBAR_TITLEBAR_INSET_CLASS,
)}
>
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/usage/UsagePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export function UsagePage() {
{isElectron && (
<div
className={cn(
"drag-region flex h-[52px] shrink-0 items-center px-5 transition-[padding-left] duration-200 ease-linear motion-reduce:transition-none wco:h-[env(titlebar-area-height)] wco:pr-[calc(100vw-env(titlebar-area-width)-env(titlebar-area-x)+1em)]",
"workspace-topbar drag-region px-5 transition-[padding-left] duration-200 ease-linear motion-reduce:transition-none wco:pr-[var(--workspace-native-controls-inset)]",
COLLAPSED_SIDEBAR_TITLEBAR_INSET_CLASS,
)}
>
Expand Down
12 changes: 12 additions & 0 deletions apps/web/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -1407,6 +1407,18 @@ body {

.electron-windows {
--desktop-window-right-resize-inset: 6px;
/* Matches DesktopWindow TITLEBAR_HEIGHT; WCO height can be transitional during restore. */
--workspace-topbar-height: 40px;
--workspace-controls-top: 0px;
--workspace-controls-left: 0.75rem;
--workspace-native-controls-width: calc(
100vw - env(titlebar-area-width, 100vw) - env(titlebar-area-x, 0px)
);
}

.electron-windows.wco {
--workspace-controls-right: calc(var(--workspace-native-controls-width) + 0.75rem);
--workspace-native-controls-inset: var(--workspace-controls-right);
Comment thread
cursor[bot] marked this conversation as resolved.
}

/* App-chrome grain. Baked into each surface's own background (behind
Expand Down
50 changes: 46 additions & 4 deletions apps/web/src/lib/windowControlsOverlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const ELECTRON_WINDOWS_CLASS_NAME = "electron-windows";

interface WindowControlsOverlayLike {
readonly visible: boolean;
readonly getTitlebarAreaRect: () => Pick<DOMRect, "width" | "right">;
addEventListener(type: "geometrychange", listener: EventListener): void;
removeEventListener(type: "geometrychange", listener: EventListener): void;
}
Expand All @@ -28,18 +29,59 @@ export function syncDocumentWindowControlsOverlayClass(): () => void {
}

const overlay = getWindowControlsOverlay();
if (!overlay) return () => {};

const root = document.documentElement;
const isWindows = isWindowsPlatform(navigator.platform);
let wasVisible = overlay.visible;
let hasGeometry = false;
let fullscreen = isWindows && window.desktopBridge?.getWindowFullscreenState?.() === true;

const applyGeometry = () => {
const rect = overlay.getTitlebarAreaRect();
const rightInset = window.innerWidth - rect.right;
if (!(rect.width > 0 && rightInset > 0 && rightInset <= window.innerWidth)) return;

root.style.setProperty("--workspace-native-controls-width", `${rightInset}px`);
hasGeometry = true;
};

const update = () => {
document.documentElement.classList.toggle(WCO_CLASS_NAME, overlay !== null && overlay.visible);
const visible = overlay.visible;
const preserveWindowsLayout = isWindows && !visible && hasGeometry && !fullscreen;
root.classList.toggle(WCO_CLASS_NAME, visible || preserveWindowsLayout);

if (!isWindows) return;

if (!visible) {
wasVisible = false;
return;
}

if (!wasVisible) {
wasVisible = true;
if (!hasGeometry) applyGeometry();
return;
}

applyGeometry();
};

const stopFullscreenListener = isWindows
? window.desktopBridge?.onWindowFullscreenStateChange?.((value) => {
fullscreen = value;
update();
})
: undefined;

update();
if (!overlay) {
return () => {};
}

overlay.addEventListener("geometrychange", update);
return () => {
stopFullscreenListener?.();
overlay.removeEventListener("geometrychange", update);
root.classList.remove(WCO_CLASS_NAME);
root.style.removeProperty("--workspace-native-controls-width");
};
}

Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/rightPanelLayout.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export const RIGHT_PANEL_INLINE_LAYOUT_MEDIA_QUERY = "(max-width: 980px)";
export const RIGHT_PANEL_SHEET_CLASS_NAME =
"w-[min(42vw,28rem)] min-w-80 max-w-[28rem] p-0 max-[760px]:w-[min(88vw,24rem)] max-[760px]:min-w-0 wco:mt-[env(titlebar-area-height)] wco:h-[calc(100%-env(titlebar-area-height))] wco:max-h-[calc(100%-env(titlebar-area-height))]";
"w-[min(42vw,28rem)] min-w-80 max-w-[28rem] p-0 max-[760px]:w-[min(88vw,24rem)] max-[760px]:min-w-0 wco:mt-[var(--workspace-topbar-height)] wco:h-[calc(100%-var(--workspace-topbar-height))] wco:max-h-[calc(100%-var(--workspace-topbar-height))]";
2 changes: 1 addition & 1 deletion apps/web/src/routes/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function SettingsContentLayout() {
{isElectron && (
<div
className={cn(
"drag-region flex h-[52px] shrink-0 items-center px-5 transition-[padding-left] duration-200 ease-linear motion-reduce:transition-none wco:h-[env(titlebar-area-height)] wco:pr-[calc(100vw-env(titlebar-area-width)-env(titlebar-area-x)+1em)]",
"workspace-topbar drag-region px-5 transition-[padding-left] duration-200 ease-linear motion-reduce:transition-none wco:pr-[var(--workspace-native-controls-inset)]",
COLLAPSED_SIDEBAR_TITLEBAR_INSET_CLASS,
)}
>
Expand Down
Loading