fix(macOS): keep window controls reachable in fullscreen - #1703
Open
Waynting wants to merge 1 commit into
Open
Conversation
Hiding the whole TitleBar in fullscreen leaves a decorationless window with no window controls at all: the close and minimize buttons go away, and so does the green button, which is the only fullscreen toggle in the app. macOS does not fill the gap, because the window is built with `decorations: false` and therefore has no native controls to reveal. Keep the bar mounted in window fullscreen instead. Sliding it in only when the pointer reaches the top edge was the obvious alternative, but that is the same gesture that summons the macOS menu bar in fullscreen, so the two fight over the same strip of screen. A bar that stays put is reachable without ever touching the top edge. `topUiEstimation` assumed the bar was absent in fullscreen and under-measured the top chrome by 50px; it now tracks the bar again. Also add a `toggle_window_fullscreen` keybind. The existing `toggle_fullscreen` action toggles the in-app image preview (`isFullScreen`), not the window (`isWindowFullScreen`), and it only fires while an image is selected, so no platform had a shortcut for window fullscreen. It defaults to F11 and is rebindable. Cmd+Ctrl+F is handled as a builtin instead. The default Tauri menu already binds it to View > Enter Full Screen, but that item does not fire for a decorationless window: logging every keydown confirms the chord reaches the webview untouched, so macOS is not consuming it as a menu key equivalent. It cannot be a rebindable combo either, because `normalizeCombo` folds Cmd and Ctrl into a single token. Fixes CyberTimon#1585
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
On macOS, entering fullscreen currently removes every window control the app has.
The window is built with
decorations: false, so the red/yellow/green buttons are drawn bysrc/window/TitleBar.tsxrather than by macOS.App.tsxrenders that bar as!isWindowFullScreen && <TitleBar />, so going fullscreen unmounts it — and the green button is the only fullscreen toggle in the app. Entering fullscreen therefore removes the way back out of it, along with close and minimize. macOS does not fill the gap either: with no titled window there are no native controls for it to reveal.This PR keeps the bar mounted in fullscreen and adds a real shortcut for window fullscreen.
Fixes #1585.
Type of Change
Changes Made
src/App.tsx— keepTitleBarmounted when the window is fullscreen.Revealing it on hover was the first thing I tried, and it does not work: sliding it in when the pointer reaches the top edge is the same gesture that summons the macOS menu bar in fullscreen, so the two land on the same strip and the menu bar intermittently covers the buttons. A bar that stays put is reachable without ever touching the top edge, which sidesteps the conflict entirely.
The in-app image fullscreen (
isFullScreen,F) still hides the bar as before, so the distraction-free view is unaffected — that mode hasEscto get out of it, which window fullscreen did not.src/App.tsx—topUiEstimationassumed the bar was absent in fullscreen and under-measured the top chrome by 50px, which skewed the computed bottom panel height. It tracks the bar again.src/utils/keyboardUtils.ts,src/hooks/useKeyboardShortcuts.ts— add atoggle_window_fullscreenkeybind, defaultF11, rebindable in Settings.The existing
toggle_fullscreenaction toggles the in-app image preview (isFullScreen), not the window (isWindowFullScreen), and only fires while an image is selected — so no platform had a shortcut for window fullscreen at all.src/hooks/useKeyboardShortcuts.ts— handleCmd+Ctrl+Fas a builtin on macOS.The default Tauri menu already binds this chord to View > Enter Full Screen, but that item does not fire for a decorationless window. I verified this rather than assuming it: logging every keydown shows
Cmd+Ctrl+Farriving in the webview with{meta: true, ctrl: true}, so macOS is not consuming it as a menu key equivalent, which matches the report in BUG: Unable to do fullscreen #1585. It cannot be expressed as a rebindable combo either, becausenormalizeCombofolds Cmd and Ctrl into a singlectrltoken.13 locale files — added the string for the new keybind rather than leaving the other 12 to fall back to English.
Screenshots/Videos
Fullscreen with the bar kept in place. The macOS menu bar still slides down when the pointer touches the very top — that is native behaviour for any fullscreen app and is not suppressed — but it no longer covers the window controls:
Testing
Verified on the hardware below, in a
tauri devbuild:Cmd+Ctrl+Ftoggles window fullscreen (it did nothing before this change).F11is intercepted by macOS for Mission Control and does not reach the app, which is expected. It is the default because Windows and Linux had no window-fullscreen shortcut at all, and it is rebindable for anyone who wants something else.tsc --noEmitreports no errors in the changed files,eslintoutput is unchanged frommain(the pre-existingno-explicit-anycount is identical),prettier --checkpasses, andvite buildsucceeds.Test Configuration:
Checklist
Additional Notes
While tracing this I also hit a related but separate problem — after a library is loaded, the only in-session entry point for switching folders is the hover-gated + Add folder row, and it disappears entirely in the compact and wide layouts. That is a UI decision rather than a bug, so I filed it separately as #1702 instead of bundling it here.