gpt4 book ai didi

macos - 如何隐藏 Dock 图标

转载 作者:行者123 更新时间:2023-12-03 16:00:19 27 4
gpt4 key购买 nike

我想选择隐藏 Dock 图标并显示 NSStatusItem。我可以创建 StatusItem,但我不知道如何从 Dock 中删除该图标。 :-/

有什么想法吗?

最佳答案

您可以使用所谓的激活策略:

目标-C

// The application is an ordinary app that appears in the Dock and may
// have a user interface.
[NSApp setActivationPolicy: NSApplicationActivationPolicyRegular];

// The application does not appear in the Dock and does not have a menu
// bar, but it may be activated programmatically or by clicking on one
// of its windows.
[NSApp setActivationPolicy: NSApplicationActivationPolicyAccessory];

// The application does not appear in the Dock and may not create
// windows or be activated.
[NSApp setActivationPolicy: NSApplicationActivationPolicyProhibited];

swift 4

// The application is an ordinary app that appears in the Dock and may
// have a user interface.
NSApp.setActivationPolicy(.regular)

// The application does not appear in the Dock and does not have a menu
// bar, but it may be activated programmatically or by clicking on one
// of its windows.
NSApp.setActivationPolicy(.accessory)

// The application does not appear in the Dock and may not create
// windows or be activated.
NSApp.setActivationPolicy(.prohibited)

这应该隐藏停靠栏图标。

另请参阅

关于macos - 如何隐藏 Dock 图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/620841/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com