From 0b14026696e0bf54d5dba8940d8ae97201ddab27 Mon Sep 17 00:00:00 2001 From: Daniel Wennberg Date: Sat, 4 Oct 2025 00:04:19 -0700 Subject: [PATCH 1/2] Expand `~` in `macos-custom-icon` --- macos/Sources/Ghostty/Ghostty.Config.swift | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/macos/Sources/Ghostty/Ghostty.Config.swift b/macos/Sources/Ghostty/Ghostty.Config.swift index 05a3be2cd..0d75922cb 100644 --- a/macos/Sources/Ghostty/Ghostty.Config.swift +++ b/macos/Sources/Ghostty/Ghostty.Config.swift @@ -314,17 +314,14 @@ extension Ghostty { var macosCustomIcon: String { #if os(macOS) - let homeDirURL = FileManager.default.homeDirectoryForCurrentUser - let ghosttyConfigIconPath = homeDirURL.appendingPathComponent( - ".config/ghostty/Ghostty.icns", - conformingTo: .fileURL).path() - let defaultValue = ghosttyConfigIconPath + let defaultValue = NSString("~/.config/ghostty/Ghostty.icns").expandingTildeInPath guard let config = self.config else { return defaultValue } var v: UnsafePointer? = nil let key = "macos-custom-icon" guard ghostty_config_get(config, &v, key, UInt(key.count)) else { return defaultValue } guard let ptr = v else { return defaultValue } - return String(cString: ptr) + guard let path = NSString(utf8String: ptr) else { return defaultValue } + return path.expandingTildeInPath #else return "" #endif From 3620132dfc449b95270703c386556278f26fa7f0 Mon Sep 17 00:00:00 2001 From: Daniel Wennberg Date: Sat, 4 Oct 2025 00:06:41 -0700 Subject: [PATCH 2/2] Remove incorrect note from config docs --- src/config/Config.zig | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/config/Config.zig b/src/config/Config.zig index caaf5feb8..bd2fe1cfb 100644 --- a/src/config/Config.zig +++ b/src/config/Config.zig @@ -2957,9 +2957,6 @@ keybind: Keybinds = .{}, /// Supported formats include PNG, JPEG, and ICNS. /// /// Defaults to `~/.config/ghostty/Ghostty.icns` -/// -/// Note: This configuration is required when `macos-icon` is set to -/// `custom` @"macos-custom-icon": ?[:0]const u8 = null, /// The material to use for the frame of the macOS app icon.