style: correct translation header and footer layout

This commit is contained in:
Valdemar Lorenzen
2026-10-15 13:43:40 +02:00
parent 5771a37fa8
commit 6574c97276
5 changed files with 42 additions and 48 deletions
+23 -4
View File
@@ -4,6 +4,8 @@ import ConjureKit
@MainActor
final class LauncherWindowController: NSWindowController, NSWindowDelegate, NSSearchFieldDelegate, NSTableViewDataSource, NSTableViewDelegate {
private let searchField = NSSearchField()
private let searchSymbol = IconView(font: .systemFont(ofSize: 20))
private let translationBack = NSButton(title: "", target: nil, action: nil)
private let tableView = ApplicationTableView()
private let statusLabel = NSTextField(labelWithString: "Finding applications…")
private let emptyLabel = NSTextField(labelWithString: "Finding applications…")
@@ -226,10 +228,20 @@ final class LauncherWindowController: NSWindowController, NSWindowDelegate, NSSe
searchField.delegate = self
searchField.setAccessibilityLabel("Search applications, calculate, or convert units and currencies")
let symbol = IconView(font: searchFont)
symbol.image = NSImage(systemSymbolName: "sparkles", accessibilityDescription: nil)
symbol.contentTintColor = SunsetPalette.accent
let header = NSStackView(views: [symbol, searchField])
searchSymbol.image = NSImage(systemSymbolName: "sparkles", accessibilityDescription: nil)
searchSymbol.contentTintColor = SunsetPalette.accent
translationBack.image = IconStyle.symbol("chevron.left", for: searchFont)
translationBack.imageScaling = .scaleProportionallyDown
translationBack.isBordered = false
translationBack.contentTintColor = SunsetPalette.secondaryText
translationBack.setAccessibilityLabel("Back to applications")
translationBack.toolTip = "Back to applications (Escape)"
translationBack.isHidden = true
NSLayoutConstraint.activate([
translationBack.widthAnchor.constraint(equalToConstant: IconStyle.applicationSize(for: searchFont)),
translationBack.heightAnchor.constraint(equalToConstant: IconStyle.applicationSize(for: searchFont)),
])
let header = NSStackView(views: [searchSymbol, translationBack, searchField])
header.orientation = .horizontal
header.alignment = .centerY
header.spacing = 12
@@ -780,6 +792,9 @@ final class LauncherWindowController: NSWindowController, NSWindowDelegate, NSSe
guard let self, let controller else { return }
controller.view.removeFromSuperview()
self.translation = nil
self.translationBack.isHidden = true
self.translationBack.target = nil
self.searchSymbol.isHidden = false
for view in self.launcherViews.dropFirst() {
view.isHidden = false
view.setAccessibilityHidden(false)
@@ -795,6 +810,10 @@ final class LauncherWindowController: NSWindowController, NSWindowDelegate, NSSe
actions.close()
(window as? LauncherPanel)?.resetNumberHints()
openButton.keyEquivalent = ""
searchSymbol.isHidden = true
translationBack.target = controller
translationBack.action = #selector(TranslationController.goBack)
translationBack.isHidden = false
searchField.stringValue = ""
searchField.placeholderAttributedString = NSAttributedString(
string: "Enter English text to translate…",