Add setting to hide icon from dock/cmd-tab

This commit is contained in:
Albert Dong
2025-01-15 12:12:42 -08:00
committed by Mitchell Hashimoto
parent aeccbd266a
commit d7a82f212a
3 changed files with 50 additions and 0 deletions

View File

@@ -533,6 +533,15 @@ class AppDelegate: NSObject,
// AppKit mutex on the appearance.
DispatchQueue.main.async { self.syncAppearance(config: config) }
// Decide whether to hide/unhide app from dock and app switcher
switch (config.macosHidden) {
case .never:
NSApp.setActivationPolicy(.regular)
case .always:
NSApp.setActivationPolicy(.accessory)
}
// If we have configuration errors, we need to show them.
let c = ConfigurationErrorsController.sharedInstance
c.errors = config.errors

View File

@@ -302,6 +302,16 @@ extension Ghostty {
return buffer.map { .init(ghostty: $0) }
}
var macosHidden: MacHidden {
guard let config = self.config else { return .never }
var v: UnsafePointer<Int8>? = nil
let key = "macos-hidden"
guard ghostty_config_get(config, &v, key, UInt(key.count)) else { return .never }
guard let ptr = v else { return .never }
let str = String(cString: ptr)
return MacHidden(rawValue: str) ?? .never
}
var focusFollowsMouse : Bool {
guard let config = self.config else { return false }
var v = false;
@@ -516,6 +526,11 @@ extension Ghostty.Config {
case download
}
enum MacHidden : String {
case never
case always
}
enum ResizeOverlay : String {
case always
case never