在 macOS 应用程序中启用浮动窗口全屏
我将应用程序窗口设置为浮动,以使它们保持在顶部:
NSApplication.shared.windows.forEach { window in
window.level = .floating
}
但是,这会禁用全屏模式:
- 绿色窗口按钮最大化窗口大小,但不会激活全屏模式
- “查看”菜单“进入全屏”项目被禁用
这两种行为(浮动窗口和全屏模式)可以并行启用吗?我检查了项目设置和开发人员文档,但没有找到任何内容。
I set the app windows to floating, to keep them on top:
NSApplication.shared.windows.forEach { window in
window.level = .floating
}
However, this disables the fullscreen mode:
- The green window button maximizes the window size but doesn't activate fullscreen mode
- The "View" menu "Enter Full Screen" item is disabled
Can these two behaviors (floating windows & fullscreen mode) be enabled in parallel? I have checked project settings and developer docs, but didn't find anything.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我通过设置
collectionBehavior
让它工作:我发现 一个类似的问题,他们还设置了窗口的一些属性(不是
级别
),并且全屏被禁用。那么,如果没有为 NSWindow 指定
collectionBehavior
,那么只要未显式设置某些 NSWindow 属性(例如level
),就会启用全屏吗?I got it to work by setting
collectionBehavior
:I found a similar SO question, they also set some properties (not the
level
) of the window, and fullscreen gets disabled.So is it that if
collectionBehavior
is not specified for an NSWindow, then fullscreen is enabled as long as certain NSWindow properties (e.g.level
) are not explicitly set?