tauri
tauri copied to clipboard
[feat] add window.set_level API
Describe the problem
I hope that the window layer can be set by setLevel.
Describe the solution you'd like
#![cfg_attr(
all(not(debug_assertions), target_os = "windows"),
windows_subsystem = "windows"
)]
use tauri::{LogicalPosition, Manager, Position};
fn main() {
let context = tauri::generate_context!();
tauri::Builder::default()
.setup(|app| {
let main_window = app.get_window("main").unwrap();
#[cfg(target_os = "macos")]
{
use cocoa::appkit::{NSMainMenuWindowLevel, NSWindow};
use cocoa::base::id;
let ns_win = main_window.ns_window().unwrap() as id;
unsafe {
ns_win.setLevel_(((NSMainMenuWindowLevel + 1) as u64).try_into().unwrap());
}
}
// main_window.set_level(WindowLevel::MainMenu+1); // ideal setup
Ok(())
})
.menu(tauri::Menu::os_default(&context.package_info().name))
.run(context)
.expect("error while running tauri application");
}
Alternatives considered
No response
Additional context
No response
/upstream tauri-apps/tao
Hey @WumaCoder , Did u get it to be in front of Full screen applications? For me it works in Dev, But when I build it; It Doesn't work...
I only tried dev
Hey @WumaCoder , Did u get it to be in front of Full screen applications? For me it works in Dev, But when I build it; It Doesn't work...
Has anyone figured out a workaround for this? It works perfectly in dev, but once I build it it doesn't work - same as @ParthJadhav
Hey @WumaCoder , Did u get it to be in front of Full screen applications? For me it works in Dev, But when I build it; It Doesn't work...
Hey @harrismcc ,
yes, @ahkohd implemented this and it works great. https://github.com/ahkohd/tauri-macos-spotlight-example
Thanks! I also found https://github.com/BillGoldenWater/ChaosDanmuTool/blob/dev/backend/src/utils/window_utils/macos.rs which I got working, but what you sent seems like it could be a better implementation so I'll look it over!
Workaround works but I would love to see support for this feature.