Skip to content
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

[macOS] feat: Add setting to hide icon from dock/cmd-tab #5122

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions macos/Sources/App/macOS/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,9 @@ 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
NSApp.setActivationPolicy(config.macosIconHidden ? .accessory : .regular)

// If we have configuration errors, we need to show them.
let c = ConfigurationErrorsController.sharedInstance
c.errors = config.errors
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 macosIconHidden: Bool {
guard let config = self.config else { return false }
var v = false;
let key = "macos-icon-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 @@ -1974,6 +1974,13 @@ keybind: Keybinds = .{},
/// This only has an effect when `macos-icon` is set to `custom-style`.
@"macos-icon-screen-color": ?ColorList = null,

/// If true, the macOS icon in the dock and app switcher 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-icon-hidden": bool = false,

/// Put every surface (tab, split, window) into a dedicated Linux cgroup.
///
/// This makes it so that resource management can be done on a per-surface
Expand Down