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

[Bug]: NSWindow does not support nonactivating panel styleMask #35815

Closed
3 tasks done
glocore opened this issue Sep 26, 2022 · 12 comments
Closed
3 tasks done

[Bug]: NSWindow does not support nonactivating panel styleMask #35815

glocore opened this issue Sep 26, 2022 · 12 comments

Comments

@glocore
Copy link

glocore commented Sep 26, 2022

Preflight Checklist

Electron Version

20.1.4

What operating system are you using?

macOS

Operating System Version

macOS Monterey 12.5

What arch are you using?

arm64 (including Apple Silicon)

Last Known Working Electron version

No response

Expected Behavior

When using BrowserWindow({ type: "panel", frame: false }), the window should appear while still keeping the previous window focused. It should appear as a non-activating panel like Spotlight or Alfred.

Actual Behavior

Previous window loses focus and the following error is seen in the terminal:

Electron[92036:3002739] NSWindow does not support nonactivating panel styleMask 0x80

Testcase Gist URL

https://gist.github.com/8e00de45bcb55d4ebbb4b597a62a75be

Additional Information

Please observe how the underlying window's cursor is still blinking and the traffic lights are enabled when activating Spotlight, vs. my Electron BrowserWindow, which blurs the underlying window. I'm showing the BrowserWindow using a global shortcut.

My.Movie.mp4
@johnlindquist
Copy link

johnlindquist commented Dec 7, 2022

Instead of win.show(), use win.showInactive() to keep the focus on the previous app.

Once in's "shown", you may also have to use win.focus() and/or win.setAlwaysOnTop() based on the behavior you want to achieve.

Fyi, I learned that from here: https://github.com/akiflow/electron-panel-window/blob/master/test/app/index.js#L33

I used that lib before switching to type:panel

@promise94
Copy link

@johnlindquist Because of the above, my problem has been solved, perfectly! Thank you so much.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 9, 2023

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

@github-actions github-actions bot added the stale label Mar 9, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Apr 9, 2023

This issue has been closed due to inactivity, and will not be monitored. If this is a bug and you can reproduce this issue on a supported version of Electron please open a new issue and include instructions for reproducing the issue.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 9, 2023
@ufukomer
Copy link

@promise94 this solution did not work for me on version 24.3.1, can you provide a code example? In my case I have a single window which has a type 'panel' and executing only the showInactive (then focus()) but still getting this error. Actually this error is not causing any issue but the main problem is that it becomes invisible after sometimes or brings up other background app (#35483).

@rmartins90
Copy link

I'm facing the same issue. Did you find any solution @ufukomer ?

@ufukomer
Copy link

ufukomer commented Oct 2, 2023

I'm facing the same issue. Did you find any solution @ufukomer ?

yes. Actually the error still remains with no harm but the issue was about using NSPanel along with some other BrowserWindow options. I removed those unnecessary BrowserWindow options then it worked like a charm. I don't remember but I can compare my BrowserWindow options with yours if you send me your BrowserWindow initialization code section.

@astoilkov
Copy link
Contributor

#35815 (comment) no longer works on Sonoma

@ufukomer
Copy link

#35815 (comment) no longer works on Sonoma

I hope it will get fixed soon

@YongzeYao
Copy link

whenever i use focus() to focus my window, the previous app loses its focus. However, if I click my window with my mouse, it works and previous app does not "lose its focus" (is still has no focus, but its state does not change). How do I achieve the mouse click effect with code? So that the previous app keeps its state?

@mp-jarvie
Copy link

NSWindow does not support nonactivating panel styleMask 0x80

It will still be forced to focus the window by other software.

@OmarHedeya95
Copy link

Not working on Sonoma. Any help?

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

10 participants