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 1 commit
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 @@ -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
xalbd marked this conversation as resolved.
Show resolved Hide resolved
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 {
xalbd marked this conversation as resolved.
Show resolved Hide resolved
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
xalbd marked this conversation as resolved.
Show resolved Hide resolved
/// 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,
xalbd marked this conversation as resolved.
Show resolved Hide resolved

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