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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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.
Can't find any method to move the window between workspaces, so I can call it before
window.show();
Beta Was this translation helpful? Give feedback.
All reactions