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

Improve kiosk mode in OSX by setting app presentation options #7201

Closed
bluthen opened this issue Nov 6, 2019 · 4 comments
Closed

Improve kiosk mode in OSX by setting app presentation options #7201

bluthen opened this issue Nov 6, 2019 · 4 comments
Assignees

Comments

@bluthen
Copy link
Contributor

bluthen commented Nov 6, 2019

NWJS Version : 0.42.2
Operating System : OSX

Expected behavior

nw.Window.get().enterKioskMode() could set proper kiosk settings for a alright kiosk mode.

Actual behavior

Goes into full screen only.

How to reproduce

In a nw app run nw.Window.get().enterKioskMode() move your mouse to the bottom, the task manager shows.

Possible Solution

I've attached a patch that may be a solution. I'm currently still working on trying to get a system set up that can build nw.js properly. An important thing is to set the NSApplicationPresentationOptions.

nwjs.kiosk.patch.txt

A very important part is:

NSApplicationPresentationOptions options = NSApplicationPresentationHideDock | NSApplicationPresentationHideMenuBar | NSApplicationPresentationDisableProcessSwitching | NSApplicationPresentationDisableForceQuit | NSApplicationPresentationDisableSessionTermination | NSApplicationPresentationDisableHideApplication | NSFullScreenWindowMask | NSApplicationPresentationDisableAppleMenu;

[NSApp setPresentationOptions:options];

In the past it was possible to set this through a node native call however after 0.34.0, this is not possible for reasons I don't understand. I think it must be done directly in nw, not through node.

nw.js group discussion: https://groups.google.com/forum/#!topic/nwjs-general/QfOQb3M5xh0

Electron's implementation

This link is also electron's version of setting kiosk mode (SetKiosk()). You can see they set the presentation options.
https://github.com/electron/electron/blob/0fe6767d6b8992d0ac3036d553ead1e529b854f3/shell/browser/native_window_mac.mm

Possible related issues

#5459

@rogerwang
Copy link
Member

Do you have proposals on how the API should be improved for this?

@bluthen
Copy link
Contributor Author

bluthen commented Nov 25, 2019

Do you have proposals on how the API should be improved for this?

I may be a bit confused. Do you mean the patch nwjs.kiosk.patch.txt I added in the first post? I just thought Window.enterKioskMode() could set the presentation options, set a high window level and set activeIgnoringOtherApps.

@rogerwang rogerwang self-assigned this Nov 25, 2019
@rogerwang
Copy link
Member

@bluthen I just pushed your patch. It will be available in the next nightly build.

@bluthen
Copy link
Contributor Author

bluthen commented Dec 4, 2019

@rogerwang This is working good for me. Thank you for putting it in!

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