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

Allow custom window level when sending window to top #7296

Merged
merged 6 commits into from Sep 28, 2016
Merged

Allow custom window level when sending window to top #7296

merged 6 commits into from Sep 28, 2016

Conversation

adammeyer
Copy link
Contributor

This allows for a custom window level to be set when sending a window to the top.

win.setAlwaysOnTop(true, 102);

This can be used when the NSFloatingWindowLevel isn't high enough. I have used this to put a window above the top menu bar.

@kevinsawicki
Copy link
Contributor

Pretty cool, mind updating the docs as well for this?

https://github.com/electron/electron/blob/master/docs/api/browser-window.md#winsetalwaysontopflag

@kevinsawicki
Copy link
Contributor

Might be useful to include the possible values as well of these https://developer.apple.com/reference/appkit/nswindow/1664726-window_levels#symbols in the docs

@kevinsawicki kevinsawicki self-assigned this Sep 21, 2016
@adammeyer
Copy link
Contributor Author

@kevinsawicki Thanks! I added the details to the docs. Currently the parameter is an integer, not a mac window level constant. I like that idea, but I'm not sure how to take a constant in as a string and then convert it to the constant value in the native window controller.

@kevinsawicki
Copy link
Contributor

I like that idea, but I'm not sure how to take a constant in as a string and then convert it to the constant value in the native window controller.

I can help you update it, what do you think about these string value names for the different integer values:

  • NSNormalWindowLevel -> 'normal'
  • NSFloatingWindowLevel -> 'floating'
  • NSTornOffMenuWindowLevel -> 'torn-off-menu'
  • NSModalPanelWindowLevel -> 'modal-panel'
  • NSMainMenuWindowLevel -> 'main-menu'
  • NSStatusWindowLevel -> 'status'
  • NSPopUpMenuWindowLevel -> 'pop-up-menu'
  • NSScreenSaverWindowLevel -> 'screen-saver'
  • NSDockWindowLevel -> 'dock'

@adammeyer
Copy link
Contributor Author

Looks great! I committed my best attempt. I'm getting some errors with the string declarations.

@kevinsawicki
Copy link
Contributor

@adammeyer I pushed a change that gets things compiling.

When testing this though it is kind of hard to tell the differences between these levels, they seem to all be very similar.

Can you expand on how you plan to use it a bit?

@adammeyer
Copy link
Contributor Author

I would like to open a window that fills the screen and is above the menu bar, without the animations that come with making a window "fullscreen". Kind of like showing a PowerPoint presentation.

I could also see it being used if you wanted multiple windows to always be on top, but one to be the top most of those.

@kevinsawicki
Copy link
Contributor

I would like to open a window that fills the screen and is above the menu bar

Which level allows this? Curious to test it locally.

@adammeyer
Copy link
Contributor Author

I believe screen-saver.

@adammeyer
Copy link
Contributor Author

Yes, just confirmed it is screen-saver

@adammeyer
Copy link
Contributor Author

@kevinsawicki Anything left to add?

@zcbenz
Copy link
Member

zcbenz commented Sep 28, 2016

👍

@matheuss
Copy link

matheuss commented Nov 1, 2016

@adammeyer I just wanted to tell you that you're my hero – this will be very useful on wulkano/kap 😄

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

Successfully merging this pull request may close these issues.

None yet

4 participants