-
Notifications
You must be signed in to change notification settings - Fork 15k
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
setVisibleOnAllWorkspaces(true, { visibleOnFullScreen: true }) api cause app dismiss in macOS dock #26350
Comments
Same with electron9.3.3 void NativeWindowMac::SetVisibleOnAllWorkspaces(bool visible,
bool visibleOnFullScreen) {
// In order for NSWindows to be visible on fullscreen we need to functionally
// mimic app.dock.hide() since Apple changed the underlying functionality of
// NSWindows starting with 10.14 to disallow NSWindows from floating on top of
// fullscreen apps.
ProcessSerialNumber psn = {0, kCurrentProcess};
if (visibleOnFullScreen) {
[window_ setCanHide:NO];
TransformProcessType(&psn, kProcessTransformToUIElementApplication);
} else {
[window_ setCanHide:YES];
TransformProcessType(&psn, kProcessTransformToForegroundApplication);
}
SetCollectionBehavior(visible, NSWindowCollectionBehaviorCanJoinAllSpaces);
SetCollectionBehavior(visibleOnFullScreen,
NSWindowCollectionBehaviorFullScreenAuxiliary);
} This makes the app dismiss from dock. TransformProcessType(&psn, kProcessTransformToUIElementApplication); No idea without setting this? |
It looks like it's happening in electron 11.0.3 as well. It was working fine in electron 9.1.1 |
try to use electron-panel-window to prevent this behavior |
I don't think this is currently a doable way as:
|
The |
@lacymorrow I still see it in the docs. What would that accomplish anyways? |
it is brought back again, see: #24956 |
I'm using screenWindow.setVisibleOnAllWorkspaces(true, {visibleOnFullScreen: true}); for window visible on full screen. it's working fine. but app is invisible in macOS dock . If i remove {visibleOnFullScreen: true} then app is visible in macOS dock. but window invisible on full screen. please share me solution if anyone have idea about that. i'm using electron version 11.5.0. |
This is an OLD bug with Electron, I have this piece of code in my app: // Enables staying on fullscreen apps for macos https://github.com/electron/electron/pull/11599
app.dock.hide()
// VisibleOnFullscreen removed in https://github.com/electron/electron/pull/21706, still does things for old versions
win.setVisibleOnAllWorkspaces( true, { visibleOnFullScreen: true } )
// If we wanted a dock, we can use it now: https://github.com/electron/electron/pull/11599
app.dock.show() I believe hiding dock before |
I was trying this solution, |
There is no way to make an electron window visible above all fullscreen window. Believe me, I've tried. The best you'll get is // Values include normal, floating, torn-off-menu, modal-panel, main-menu, status, pop-up-menu, screen-saver
targetWindow.setAlwaysOnTop( true, 'screen-saver' ) If you ever figure it out, please let me know. |
@lacymorrow
Last update(2022-06-07): |
@kyle-go Do you have an example repo to test/reproduce with? |
@kyle-go any update on this? |
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! |
bump |
bump |
2 similar comments
bump |
bump |
Ran into this and found a configuration that seems to work. The key seems to be not setting window = new BrowserWindow({
// DO NOT set fullscreenable here
// fullscreenable: false,
});
window.setVisibleOnAllWorkspaces(true, { visibleOnFullScreen: true });
// NOTE: Make sure this is called after setVisibleOnAllWorkspaces + visibleOnFullScreen
// otherwise it will not actually show over fullscreen windows
window.setFullScreenable(false); not sure if everyone in this thread was using |
This worked for me, thanks |
Not working for me :( |
Found the solution. Just set
|
doesn't work in windows, Electron 9-11 |
but this issue about macOS dock problem. |
Does this not work for you? I'm running electron 11 I believe |
Works, but it's not a 100% solution. I found some cases where dock can completely disappear. |
I have been sticking with Electron 11 because of this exact issue, looks like I have some testing to do, |
Nevermind. |
Found another trick. This problem solved by combining dock methods and
|
Finally able to figure it out. BrowserWindow settings
Method calls while creating window
And now it's working perfectly on all workspaces and full-screen mode, without causing dock issue electron: 22.0.0 UPD: No need to call
|
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! |
I try this, but not working |
Did you don't forget to set I created a demo-project by using electron-react-boilerplate, you can try it: |
I added type 'panel' but not working, Here I mentioned my code below. Please let me know if there's an error. win = new BrowserWindow({
|
skipTransformProcessType must also be set to true:
Checkout this demo if it's not working properly maybe it depends on OS or Electron version |
your demo is working fine. but not working in my app |
Just set
|
Caution that From the docs:
|
I can confirm this works as long as you set |
This worked for me! myWindow.setAlwaysOnTop(true, "floating"); |
Preflight Checklist
Issue Details
Expected Behavior
after setVisibleOnAllWorkspaces(true, { visibleOnFullScreen: true }) , app should visible in macOS dock
Actual Behavior
after setVisibleOnAllWorkspaces(true, { visibleOnFullScreen: true }) , app is invisible in macOS dock
To Reproduce
mainWindow.setVisibleOnAllWorkspaces(true, { visibleOnFullScreen: true });
inmain.js
yarn start
Screenshots
Additional Information
maybe it cause by
visibleOnFullScreen: true
,when app‘s icon dismiss from dock, app.dock.show() is not work. electron@9.2.1 is work, butvisibleOnFullScreen: true
is removed.The text was updated successfully, but these errors were encountered: