-
I'm hiding the window on the close event, and because of that, when you open the window again, it opens in the same workspace, not the workspace you're in. |
Beta Was this translation helpful? Give feedback.
Answered by
Mehdi-Hp
Sep 17, 2024
Replies: 1 comment 1 reply
-
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,
);
}
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Mehdi-Hp
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For anyone else looking for a solution, here's the implementation for macOS: