mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-18 05:20:29 +00:00
ci: fix linting and delete non-useful tests
This commit is contained in:
@@ -928,7 +928,7 @@ class AppDelegate: NSObject,
|
||||
} else {
|
||||
GlobalEventTap.shared.disable()
|
||||
}
|
||||
|
||||
|
||||
updateAppIcon(from: config)
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ enum AppIcon: Equatable, Codable {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
func image(in bundle: Bundle) -> NSImage? {
|
||||
switch self {
|
||||
case .official:
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user