Skip to content

Commit

Permalink
Add setting to hide icon from dock/cmd-tab
Browse files Browse the repository at this point in the history
  • Loading branch information
xalbd committed Jan 15, 2025
1 parent ff9414d commit 9e38bcf
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions macos/Sources/App/macOS/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,9 @@ class AppDelegate: NSObject,
// this is called as part of application launch it can deadlock with an internal
// AppKit mutex on the appearance.
DispatchQueue.main.async { self.syncAppearance(config: config) }

// Decide whether to hide/unhide app from dock and cmd-tab
NSApp.setActivationPolicy(config.macosHidden ? .accessory : .regular)

// If we have configuration errors, we need to show them.
let c = ConfigurationErrorsController.sharedInstance
Expand Down
8 changes: 8 additions & 0 deletions macos/Sources/Ghostty/Ghostty.Config.swift
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,14 @@ extension Ghostty {
return buffer.map { .init(ghostty: $0) }
}

var macosHidden: Bool {
guard let config = self.config else { return false }
var v = false;
let key = "macos-hidden"
_ = ghostty_config_get(config, &v, key, UInt(key.count))
return v;
}

var focusFollowsMouse : Bool {
guard let config = self.config else { return false }
var v = false;
Expand Down
7 changes: 7 additions & 0 deletions src/config/Config.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1909,6 +1909,13 @@ keybind: Keybinds = .{},
/// you may want to disable it.
@"macos-secure-input-indication": bool = true,

/// If true, the macOS icon in the dock and cmd-tab will be hidden. This is
/// mainly intended for those primarily using the quick-terminal mode.
///
/// Note that setting this to true means that keyboard layout changes
/// will no longer be automatic.
@"macos-hidden": bool = false,

/// Customize the macOS app icon.
///
/// This only affects the icon that appears in the dock, application
Expand Down

0 comments on commit 9e38bcf

Please sign in to comment.