style: use emoji icons for Notes and Translate

This commit is contained in:
2026-10-17 21:15:02 +02:00
parent 378cad4bf1
commit b847a483f0
3 changed files with 15 additions and 10 deletions
+10 -6
View File
@@ -40,8 +40,12 @@ final class LauncherWindowController: NSWindowController, NSWindowDelegate, NSSe
private var isCommandOpen: Bool { activeCommand != nil }
private var activeCommand: Application.Command?
private var pendingPresentation: (() -> Void)?
private static let emojiIcon: NSImage = {
let text = NSAttributedString(string: "🤔", attributes: [.font: NSFont.systemFont(ofSize: 28)])
private static let emojiIcon = makeEmojiIcon("🤔")
private static let notesIcon = makeEmojiIcon("📔")
private static let translateIcon = makeEmojiIcon("🌏")
private static func makeEmojiIcon(_ emoji: String) -> NSImage {
let text = NSAttributedString(string: emoji, attributes: [.font: NSFont.systemFont(ofSize: 28)])
let line = CTLineCreateWithAttributedString(text)
return NSImage(size: NSSize(width: 32, height: 32), flipped: false) { rect in
guard let context = NSGraphicsContext.current?.cgContext else { return false }
@@ -51,7 +55,7 @@ final class LauncherWindowController: NSWindowController, NSWindowDelegate, NSSe
CTLineDraw(line, context)
return true
}
}()
}
init(history: LaunchHistory = LaunchHistory(), uninstaller: ApplicationUninstaller = ApplicationUninstaller(),
defaults: UserDefaults = .standard, pasteboard: NSPasteboard = .general, notesDirectory: URL? = nil) {
@@ -577,13 +581,13 @@ final class LauncherWindowController: NSWindowController, NSWindowDelegate, NSSe
cell.imageView?.image = Self.emojiIcon
cell.toolTip = "Search and copy emoji"
case .notes:
cell.imageView?.image = NSImage(systemSymbolName: "note.text", accessibilityDescription: nil)
cell.imageView?.image = Self.notesIcon
cell.toolTip = "Write notes with Markdown and images"
default:
cell.imageView?.image = NSImage(systemSymbolName: "character.bubble", accessibilityDescription: nil)
cell.imageView?.image = Self.translateIcon
cell.toolTip = "Translate English to Japanese"
}
cell.imageView?.contentTintColor = entry.command == .emoji ? nil : SunsetPalette.accent
cell.imageView?.contentTintColor = nil
} else {
let application = results[row]
cell.textField?.stringValue = application.name