Skip to content

Commit 6912a95

Browse files
committed
fix(macos): restore native fullscreen controls
Equalize titlebar gaps, use Control-Command-F for fullscreen, and keep native traffic lights available when the system fullscreen titlebar reveals.
1 parent 2896ebf commit 6912a95

3 files changed

Lines changed: 18 additions & 3 deletions

File tree

‎electron/main/windows/window-controller.mjs‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,13 @@ export function createWindowController({
5858
};
5959
const updateWindowButtons = (target) => {
6060
if (process.platform !== 'darwin' || !target || target.isDestroyed()) return;
61-
const visible = !target.isFullScreen() && !registry.stateFor(target)?.headerHidden;
61+
const fullscreen = target.isFullScreen();
62+
// Fullscreen's native titlebar reveals with the system menu bar, even
63+
// while the reader hides its own toolbar. Do not hide its standard buttons.
64+
const visible = fullscreen || !registry.stateFor(target)?.headerHidden;
6265
target.setWindowButtonVisibility(visible);
63-
if (visible) target.setWindowButtonPosition(windowChromeOptions('darwin').trafficLightPosition);
66+
if (visible && !fullscreen)
67+
target.setWindowButtonPosition(windowChromeOptions('darwin').trafficLightPosition);
6468
};
6569
const hideNativeMenuBar = (target) => {
6670
if (!['win32', 'linux'].includes(process.platform) || !target || target.isDestroyed()) return;

‎shared/commands/shortcuts.mjs‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ export function shortcutAction(platform, input) {
2929
if (key === 'pagedown' || (input.shift && ['arrowdown', 'arrowright'].includes(key)))
3030
return 'page-next';
3131
}
32-
if (key === 'f11' && !input.meta && !input.control && !input.alt) return 'toggle-fullscreen';
32+
if (platform !== 'darwin' && key === 'f11' && !input.meta && !input.control && !input.alt)
33+
return 'toggle-fullscreen';
34+
if (platform === 'darwin' && key === 'f' && input.meta && input.control && !input.alt && !input.shift)
35+
return 'toggle-fullscreen';
3336
if (platform === 'darwin') {
3437
if (key === 'w' && input.control && !input.meta && !input.alt && !input.shift)
3538
return 'close-window';

‎src/ui/styles/features/reader/layered/toolbar.css‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,14 @@
177177
grid-template-columns: minmax(0, 1fr) max-content;
178178
}
179179

180+
/* Native lights start at x=18 and span 52px (three 12px lights, 20px apart).
181+
Match the window inset, lights-to-button gap, and button-to-title gap. */
182+
.desktop[data-platform='darwin'] .toolbar {
183+
--macos-titlebar-gap: 18px;
184+
padding-left: calc(52px + 2 * var(--macos-titlebar-gap));
185+
column-gap: var(--macos-titlebar-gap);
186+
}
187+
180188
.desktop .toolbar > .icon-button:first-of-type {
181189
margin: 0;
182190
}

0 commit comments

Comments
 (0)