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

closable/minimizable/maximizable/resizable in NSPanel #31

Closed
doroved opened this issue Apr 1, 2024 · 5 comments
Closed

closable/minimizable/maximizable/resizable in NSPanel #31

doroved opened this issue Apr 1, 2024 · 5 comments
Assignees

Comments

@doroved
Copy link

doroved commented Apr 1, 2024

As far as I know, you can customize controls in NSPanel just like in NSWindow.
Could you please add to the example how to display closable/minimizable/maximizable elements?
And also the implementation of resizable is also interesting.
Thanks)

image
@ahkohd
Copy link
Owner

ahkohd commented Apr 15, 2024

Add the const NSResizableWindowMask: i32 = 1 << 3; style mask to make the menubar panel resizable.

image

@ahkohd
Copy link
Owner

ahkohd commented Apr 15, 2024

It does not make sense for a menubar panel to be minimizable or maximizable.

@ahkohd ahkohd self-assigned this Apr 15, 2024
@ahkohd
Copy link
Owner

ahkohd commented Apr 15, 2024

This menubar panel example uses NSWindowStyleMaskNonactivatingPanel to prevent the panel from stealing focus from the active window that is not the panel.

Given this, using NSWindowStyleMaskNonactivatingPanel precludes the panel from having a standard title bar (as the window won't be active, you can't directly interact with the title bar).

You will have to implement these buttons, and the titlebar yourself. See this guide: https://tauri.app/v1/guides/features/window-customization/

@doroved
Copy link
Author

doroved commented Apr 15, 2024

It does not make sense for a menubar panel to be minimizable or maximizable.

Add the const NSResizableWindowMask: i32 = 1 << 3; style mask to make the menubar panel resizable.

image

Thanks, it works fine. Maybe if you can set minimum panel sizes below which the resize won't work, it would be perfect.
All in all, the problem can be closed.

@ahkohd
Copy link
Owner

ahkohd commented Apr 15, 2024

We can add the method to set the minimum size of a panel, i.e., panel.minSize(width, height), to the tauri-nspanel plugin.

You can create an issue there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants