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

[feat] ability to listen to when window is going to go full screen (macOS) #7162

Open
AndrewBastin opened this issue Jun 8, 2023 · 1 comment

Comments

@AndrewBastin
Copy link

Describe the problem

Tauri provides the tauri://resize event that can emit events when the window changes size and also (in macOS) when the app has entered/left full screen (emphasis on the past tense). But there are situations where we want to know if the window is going to leave/enter full screen (as in future).

One example for such is basically, lets say you have a header area and you want to inline the window controls into the window (a common macOS design style), we need to leave space for the window controls on the top left of the window. This space is not required in full screen as window controls are not present there. With the resize event, the current situation is that, if we toggled based on the Window#isFullScreen() property on the callback for the event, we only receive the callback after the window is done animating out of the full screen mode into the windowed view. This leads to a couple of moments where the spacing is not applied eventhough the window control is coming in.

Here is a video demo of roughly what I mean, the goal is to keep the emoji rendered aside the window controls, see how on leaving full screen we have few frames where the emoji is behind the window controls:

Screen.Recording.2023-06-08.at.12.02.48.PM.mov

Describe the solution you'd like

macOS does provide an event windowWillExitFullScreen and windowWillEnterFullScreen [reference] to NSWindowDelegates that I am pretty sure Tao implements but doesn't expose into the event system. I think a way to access this event will be cool.

Alternatives considered

Currently we internally literally override the NSWindowDelegate implementation Tao provides and add these as custom events but that is super brittle and weird.

Additional context

I think this maybe a Tao specific request and might need to be moved to that repo, but I leave it to the maintainers to decide that.

@Hacksore
Copy link
Contributor

Hacksore commented Jun 11, 2024

This feature could def be used to unblock overlayeddev/overlayed#108.

It would make it so that I only have to enable set_activation_policy(tauri::ActivationPolicy::Accessory) when entering fullscreen mode and I can go back to Regular upon leaving fullscreen.

As of now if I enable the activation policy as accessory it will omit app item from the CMD+Tab menu 😞.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 📬Proposal
Development

No branches or pull requests

2 participants