feat(config): allow macOS fullscreen and transparent APIs to be enabled independently#15640
feat(config): allow macOS fullscreen and transparent APIs to be enabled independently#15640tenderdeve wants to merge 2 commits into
Conversation
velocitysystems
left a comment
There was a problem hiding this comment.
Great work @tenderdeve. I also know another contributor was looking into this. Any thoughts or feedback @polw1?
| "default": { | ||
| "enableGTKAppId": false, | ||
| "macOS": { | ||
| "fullscreenApi": false, |
There was a problem hiding this comment.
Recommend we match the naming of the crate feature flags:
privateApiFullscreenprivateApiTransparent
Prefixing them with privateApi* makes it immediately obvious the user is opting into a private API.
| devtools = ["wry/devtools", "tauri-runtime/devtools"] | ||
| x11 = ["tao/x11", "wry/x11"] | ||
| macos-private-api-fullscreen = ["wry/fullscreen"] | ||
| macos-private-api-transparent = ["wry/transparent", "tauri-runtime/macos-private-api"] |
There was a problem hiding this comment.
One thing about this feature mapping:
I understand this is technically fine today because this is in tauri-runtime, but at the same time, reading that the new transparent-only feature enables the old macos-private-api feature can feel a bit confusing at first.
It also means tauri-runtime/macos-private-api effectively has to keep meaning “transparent support”.
Maybe that tradeoff is perfectly fine if we do not expect more macOS private API gates in tauri-runtime.
But from an API design perspective, I wonder if it would be clearer to mirror the split in tauri-runtime too and keep the old feature as an alias:
macos-private-api = ["macos-private-api-transparent"]
macos-private-api-transparent = []That would keep compatibility while making the mapping read more directly:
tauri/macos-private-api-transparent
-> tauri-runtime/macos-private-api-transparent
-> tauri-runtime-wry?/macos-private-api-transparent
-> wry/transparent
Not a blocker from my side, mostly a naming/design tradeoff that maintainers may have a better feel for
| "tauri-utils/process-relaunch-dangerous-allow-symlink-macos", | ||
| ] | ||
| macos-private-api = [ | ||
| macos-private-api-fullscreen = ["tauri-runtime-wry?/macos-private-api-fullscreen"] |
There was a problem hiding this comment.
Should we also update the crate-level feature docs in crates/tauri/src/lib.rs?
The existing macos-private-api feature is documented there, but these two new public features (macos-private-api-fullscreen and macos-private-api-transparent) are not listed yet.
Since users can now enable them directly, it may be useful to document them next to the existing legacy macos-private-api entry so they show up clearly in the generated crate docs
…ed independently Split the coupled `macOSPrivateApi` flag into `app > macOS > fullscreenApi` and `app > macOS > transparentBackgroundApi`, backed by new `macos-private-api-fullscreen` and `macos-private-api-transparent` Cargo features. `macOSPrivateApi` stays as a compatibility alias enabling both. Closes tauri-apps#15487
9444cb5 to
50bc9d9
Compare
|
thanks for the review both @polw1 added the docs for the two new features in fea51b2, sat them right next to the existing macos-private-api entry in lib.rs. re mirroring the split into tauri-runtime - i left it on the umbrella name because tauri-runtime's own gates (window.rs / webview.rs) still cfg on macos-private-api, so making it read -transparent all the way down means renaming those cfg attrs too. don't mind doing that but since you said it's non-blocking / a maintainer-feel thing i'll leave that call to them rather than touch the runtime gates unprompted. @velocitysystems the keys currently sit under app > macOS > { fullscreenApi, transparentBackgroundApi } and are documented as private-api opt-ins. can rename to privateApiFullscreen / privateApiTransparent no problem, just want a maintainer ok first since it's public config schema. will change it as soon as there's a thumbs up. |
Closes #15487
macOSPrivateApicurrently couples two unrelated capabilities: it enables the WKWebView fullscreen API and transparent webview backgrounds. Apps that only need fullscreen are forced to also opt into the transparent-background private API. wry already exposes these as separatefullscreen/transparentfeatures, so this splits them at the Tauri layer too.Changes
app > macOS > fullscreenApiandapp > macOS > transparentBackgroundApi.macos-private-api-fullscreen(→wry/fullscreen) andmacos-private-api-transparent(→wry/transparent).macOSPrivateApikept as-is; it now enables both sub-features, so existing configs are unchanged.AppConfig::features()emits only the sub-feature(s) the config actually needs.cfggates intauri/tauri-runtime-wryretargeted tomacos-private-api-transparent; fullscreen is compile-time viawry/fullscreen.Testing
cargo test -p tauri-utils(config tests pass).cargo check -p tauri -p tauri-runtime-wryunder each of the three feature combinations.