Open hgl opened 2 years ago
I did some experiments:
Given the empty window, if I drag the mouse through where the heading should be and right click, the menu prompts me to search for the text.
If I remove this line, then the content is correctly displayed, but without vibrancy:
It seems the issue stems from the vibrancy view covering the webkit view.
I wonder if the latest version of tauri, or its creation of the webkit view for macOS 10.13.6 is special, which causes this plugin to add the subview first?
I tried this, same result:
fn main() {
let context = tauri::generate_context!();
tauri::Builder::default()
.menu(if cfg!(target_os = "macos") {
tauri::Menu::os_default(&context.package_info().name)
} else {
tauri::Menu::default()
})
.build(context)
.expect("error while running tauri application")
.run(|app_handle, event| match event {
tauri::RunEvent::Ready {} => {
let window = app_handle.get_window("main").unwrap();
#[cfg(target_os = "macos")]
apply_vibrancy(&window, NSVisualEffectMaterial::Sidebar)
.expect("Unsupported platform! 'apply_vibrancy' is only supported on macOS");
}
_ => {}
});
}
I have the same issue I think. The WebView background is white. Even if I set it to transparent using CSS. Also I see a vibrancy for a split second when the window is showing.
@alexgraddev if you're on macos: Did you enable the private apis? It's necessary for transparency, see: https://tauri.app/v1/api/config#tauriconfig.macosprivateapi
@FabianLars, didn't know about it. Now it works. Thank you!
P.S. I think it should be in the window-vibrancy
documentation, or at least in the example for the Tauri.
Is there a way it can check that and output a message to console if it isn't enabled?
Yes that would be possible, but imo it should be enough that every transparency api doc mentions it, right?
p.s. i guess adding it to the readme/example here is fair tho? idk
I think the api doc for transparent is enough. This plugin shouldn't care how you enable transparency for your window.
I don't think I'm experiencing the same issue as @alexgraddev did.
I have set tauri.macOSPrivateApi
to true
in src-tauri/tauri.conf.json
, same result, and I don't see any white background of web view or vibrancy window for a split second. The vibrancy window always covers everything.
I don't think I'm experiencing the same issue as @alexgraddev did.
I have set
tauri.macOSPrivateApi
totrue
insrc-tauri/tauri.conf.json
, same result, and I don't see any white background of web view or vibrancy window for a split second. The vibrancy window always covers everything.
I had the same, just added this line to tauri.conf.json
and it works now:
https://github.com/tauri-apps/window-vibrancy/blob/dev/examples/tauri/src-tauri/tauri.conf.json#L57
@alexgraddev if you're on macos: Did you enable the private apis? It's necessary for transparency, see: https://tauri.app/v1/api/config#tauriconfig.macosprivateapi
I enabled macOSPrivateApi
, set "transparent": true
and it works now. https://github.com/tauri-apps/window-vibrancy/blob/dev/examples/tauri/src-tauri/tauri.conf.json#L57
Edited the readme instructions mentioning these additional steps. https://github.com/tauri-apps/window-vibrancy/pull/116
When I apply this plugin in macOS 10.13.6, I got an empty window with vibrancy applied:
If I remove the setup code, the content is correctly displayed:
I created the project with
npm create tauri-app
, and used the svelte framework. Any idea how to fix it?My configs:
src-tauri/src/main.rs
public/index.html
src-tauri/Cargo.toml