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 3 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
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. |
|
i think splitting it in tauri-runtime makes sense (though i doubt we'll see more uses of private apis there) don't care where the keys are, i can see both working so i'll leave that to who was pinged :P |
fea51b2 to
a8cfb9a
Compare
velocitysystems
left a comment
There was a problem hiding this comment.
@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.
@tenderdeve I'd recommend privateApiFullscreen / privateApiTransparent as siblings of macOSPrivateApi, not app.macOS.*:
- We already have
bundle > macOS. Adding a second configuration object is unecessary complexity. - Flat
privateApi*keys keep the "you're opting into a private API" signal in the name and map 1:1 to the Cargo features.
i think splitting it in tauri-runtime makes sense (though i doubt we'll see more uses of private apis there). Don't care where the keys are, i can see both working so i'll leave that to who was pinged :P we probably should mark the old umbrella key as deprecated though (check
minimum_webview2_versionfor an example) - agreed? @velocitysystems
@FabianLars Agreed. Please see deprecated pattern @tenderdeve.
|
Pushed f749171 addressing all the feedback: @velocitysystems renamed the granular opt-ins to flat @polw1 mirrored the split into @FabianLars deprecation + runtime split both in. Checked green with |
|
Looks good. Passing over to @FabianLars for a final review. Thanks @tenderdeve! |
…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
Rename the granular opt-ins from the nested app.macOS.{fullscreenApi,
transparentBackgroundApi} object to flat privateApiFullscreen /
privateApiTransparent keys so they sit as siblings of macOSPrivateApi
and read 1:1 with the Cargo features.
Deprecate the legacy macOSPrivateApi umbrella (still enables both).
Mirror the feature split into tauri-runtime: add
macos-private-api-transparent and keep macos-private-api as an alias.
|
ngl i kinda like the app > macOS object but i'm also considering to remove the flag for transparency since that apparently never caused issues in store reviews. but yeah, i'm okay with keeping it top level, but then i'd prefix them with macos again, eg |
|
additionally, seems like on recent-ish macos/ios versions the fullscreen api is not private anymore: https://developer.apple.com/documentation/webkit/wkpreferences/iselementfullscreenenabled Edit: it's not actually the same property but from its name it sounds like it does what we need. |
@FabianLars I think my suggestion may have been misunderstood. I was advocating for them to be under |
|
nah, under bundle > macOS it makes no sense imo. That's for bundle(r) (as-in tauri-bundler) stuff, it generally shouldn't contain runtime/config things, but the private apis are a bit of a grey zone, they could maybeee fit into both categories. |
@FabianLars What about
|
f749171 to
a1b0981
Compare
|
That would for me as well i think.
@Legend-Master How do you feel about yet another breaking change in 2.12? 😂 (meaning raising the minimum macos version for the webview element fullscreen functionality) (also wouldn't mind your opinion on the block for the 2 apis here if we'll add them) |
|
Thanks both — following the thread, sounds like the landing spot is Before I churn the schema again though: @FabianLars you also raised possibly dropping the transparency flag and swapping the fullscreen private API for a macOS-version check on So: should I go ahead and relocate to |
|
If the new API works, I think we can really keep the current |
|
In theory they can remove private apis but I've yet to see that happen. Though aside from those we use, it's quite rare to use private apis I think. And if these 2 get removed that's also fine because both basically just set a Map value, we don't even use an actual api. |
|
Gentle nudge on this one so it doesn't go stale — sounds like the thread landed on two possible directions:
Both are small changes from where the PR sits now; I just don't want to churn the schema twice. Happy to push whichever you land on — @FabianLars @Legend-Master @velocitysystems, what's the call? |
|
Sorry i forgot to update you here. After some more research, and realizing that we already had an unguarded private property in wry for a while, i decided to see how things go without the feature flags: tauri-apps/wry#1779 |
|
Following up now that wry#1779 landed — nice, fullscreen working without the private API changes the picture here quite a bit. If the plan is to drop the flags entirely (fullscreen riding the version check, transparency going unguarded since it never tripped store review), then this split PR mostly becomes the wrong direction and I'd rather not churn the schema toward So before I touch anything else: do you want to
Whichever you prefer @FabianLars — just don't want to guess and redo the schema twice. |
|
In tauri 2.12 macOSPrivateApis will become no-op and marked as deprecated. This indeed makes this PR completely obsolete. |
|
Thanks @FabianLars. I've updated #15487 as resolved by #tauri-apps/wry#1779. |

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.