ci: fix linting and delete non-useful tests

This commit is contained in:
Lukas
2026-02-24 10:13:24 +01:00
parent f831f68f1a
commit c72788894e
5 changed files with 9 additions and 29 deletions

View File

@@ -928,7 +928,7 @@ class AppDelegate: NSObject,
} else {
GlobalEventTap.shared.disable()
}
updateAppIcon(from: config)
}

View File

@@ -56,7 +56,7 @@ enum AppIcon: Equatable, Codable {
}
}
#endif
func image(in bundle: Bundle) -> NSImage? {
switch self {
case .official:

View File

@@ -4,9 +4,9 @@ class DockTilePlugin: NSObject, NSDockTilePlugIn {
// WARNING: An instance of this class is alive as long as Ghostty's icon is
// in the doc (running or not!), so keep any state and processing to a
// minimum to respect resource usage.
private let pluginBundle = Bundle(for: DockTilePlugin.self)
// Separate defaults based on debug vs release builds so we can test icons
// without messing up releases.
#if DEBUG
@@ -84,7 +84,7 @@ class DockTilePlugin: NSObject, NSDockTilePlugIn {
appIcon = pluginBundle.image(forResource: "AppIconImage")!
NSWorkspace.shared.setIcon(appIcon, forFile: appBundlePath)
}
NSWorkspace.shared.noteFileSystemChanged(appBundlePath)
dockTile.setIcon(appIcon)
}

View File

@@ -3,26 +3,26 @@ import AppKit
extension UserDefaults {
private static let customIconKeyOld = "CustomGhosttyIcon"
private static let customIconKeyNew = "CustomGhosttyIcon2"
var appIcon: AppIcon? {
get {
// Always remove our old pre-docktileplugin values.
defer {
removeObject(forKey: Self.customIconKeyOld)
}
// Check if we have the new key for our dock tile plugin format.
guard let data = data(forKey: Self.customIconKeyNew) else {
return nil
}
return try? JSONDecoder().decode(AppIcon.self, from: data)
}
set {
guard let newData = try? JSONEncoder().encode(newValue) else {
return
}
set(newData, forKey: Self.customIconKeyNew)
}
}

View File

@@ -1,20 +0,0 @@
@testable import Ghostty
import Testing
struct CustomIconTests {
@Test func migration() {
#expect(Ghostty.CustomAppIcon.blueprint == Ghostty.CustomAppIcon(string: "blueprint"))
#expect(nil == Ghostty.CustomAppIcon(string: "~/downloads/some/file.png"))
#expect(nil == Ghostty.CustomAppIcon(string: "#B0260C"))
#expect(nil == Ghostty.CustomAppIcon(string: "plastic"))
#expect(Ghostty.CustomAppIcon.customStyle(ghostColorHex: "#B0260C", screenColorHexes: [], iconFrame: .plastic) == Ghostty.CustomAppIcon(string: "#B0260C_plastic"))
#expect(Ghostty.CustomAppIcon.customStyle(ghostColorHex: "#B0260C", screenColorHexes: ["#4F2C27"], iconFrame: .plastic) == Ghostty.CustomAppIcon(string: "#B0260C_#4F2C27_plastic"))
#expect(Ghostty.CustomAppIcon.customStyle(ghostColorHex: "#B0260C", screenColorHexes: ["#4F2C27", "#B0260C"], iconFrame: .plastic) == Ghostty.CustomAppIcon(string: "#B0260C_#4F2C27_#B0260C_plastic"))
}
}