Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose the collection behavior on mac (always on top hides in mission control) #890

Open
jkelleyrtp opened this issue Mar 20, 2024 · 0 comments

Comments

@jkelleyrtp
Copy link
Contributor

jkelleyrtp commented Mar 20, 2024

Expose the nswindowbehavior managed on macos.

Also, would be nice if "set_always_on_top" also set this flag so the window wouldn't disappear from mission control when you make it sticky. I would expect the behavior for "always on top" to match that of sticky notes on mac, which both float on top and participate in window management.

More info here:
https://developer.apple.com/documentation/appkit/nswindowcollectionbehavior/nswindowcollectionbehaviormanaged

Here's the code:

        // https://developer.apple.com/documentation/appkit/nswindowcollectionbehavior/nswindowcollectionbehaviormanaged
        #[cfg(target_os = "macos")]
        {
            use cocoa::appkit::NSWindowCollectionBehavior;
            use cocoa::base::id;
            use objc::{msg_send, sel, sel_impl};
            use tao::platform::macos::WindowExtMacOS;

            unsafe {
                let window: id = window.ns_window() as id;
                let _: () = msg_send![window, setCollectionBehavior: NSWindowCollectionBehavior::NSWindowCollectionBehaviorManaged];
            }
        }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant