Skip to content
Discussion options

You must be logged in to vote

For anyone else looking for a solution, here's the implementation for macOS:

#[cfg(target_os = "macos")]
pub fn move_to_active_space(webview_window: &tauri::WebviewWindow) {
    extern crate cocoa;
    extern crate objc;
    use cocoa::appkit::{NSWindow, NSWindowCollectionBehavior};
    use cocoa::base::nil;
    use objc::runtime::Object;
    let ns_window = webview_window.ns_window().unwrap() as *mut Object;
    unsafe {
        ns_window.makeKeyAndOrderFront_(nil);
        ns_window.setCollectionBehavior_(
            NSWindowCollectionBehavior::NSWindowCollectionBehaviorMoveToActiveSpace,
        );
    }
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Schachte
Comment options

Answer selected by Mehdi-Hp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants