feat: refine footer key badges and uninstall shortcuts

This commit is contained in:
2026-10-12 23:47:41 +02:00
parent 47aa757526
commit f0ab87e797
3 changed files with 62 additions and 16 deletions
@@ -86,8 +86,11 @@ final class UninstallReviewController: NSViewController, NSSearchFieldDelegate,
remove.target = self
remove.action = #selector(confirmUninstall)
remove.contentTintColor = .systemRed
remove.bezelStyle = .rounded
remove.isBordered = false
remove.font = .systemFont(ofSize: 14, weight: .medium)
remove.keyEquivalent = "\r"
remove.keyEquivalentModifierMask = .command
remove.toolTip = "Confirm uninstall (Command-Return). Return toggles the highlighted file."
remove.isEnabled = false
table.addTableColumn(NSTableColumn(identifier: NSUserInterfaceItemIdentifier("file")))
table.headerView = nil
@@ -107,7 +110,31 @@ final class UninstallReviewController: NSViewController, NSSearchFieldDelegate,
scroll.autohidesScrollers = true
scroll.drawsBackground = false
scroll.contentView.drawsBackground = false
let footer = NSStackView(views: [NSView(), remove])
let pill = NSVisualEffectView()
pill.material = .popover
pill.blendingMode = .withinWindow
pill.state = .active
roundMaterialCorners(pill, radius: 18)
pill.layer?.borderWidth = 0.5
pill.layer?.borderColor = SunsetPalette.accent.withAlphaComponent(0.35).cgColor
pill.layer?.backgroundColor = SunsetPalette.accent.withAlphaComponent(0.08).cgColor
let commandKey = shortcutBadge("⌘")
let returnKey = shortcutBadge("↵")
for child in [remove, commandKey, returnKey] {
child.translatesAutoresizingMaskIntoConstraints = false
pill.addSubview(child)
}
NSLayoutConstraint.activate([
pill.heightAnchor.constraint(equalToConstant: 36),
remove.leadingAnchor.constraint(equalTo: pill.leadingAnchor, constant: 14),
remove.centerYAnchor.constraint(equalTo: pill.centerYAnchor),
commandKey.leadingAnchor.constraint(equalTo: remove.trailingAnchor, constant: 8),
commandKey.centerYAnchor.constraint(equalTo: pill.centerYAnchor),
returnKey.leadingAnchor.constraint(equalTo: commandKey.trailingAnchor, constant: 4),
returnKey.centerYAnchor.constraint(equalTo: pill.centerYAnchor),
returnKey.trailingAnchor.constraint(equalTo: pill.trailingAnchor, constant: -12)
])
let footer = NSStackView(views: [NSView(), pill])
footer.orientation = .horizontal
footer.spacing = 12
for view in [header, status, scroll, footer] {
@@ -132,7 +159,7 @@ final class UninstallReviewController: NSViewController, NSSearchFieldDelegate,
footer.leadingAnchor.constraint(equalTo: search.leadingAnchor),
footer.trailingAnchor.constraint(equalTo: search.trailingAnchor),
footer.bottomAnchor.constraint(equalTo: content.bottomAnchor, constant: -16),
footer.heightAnchor.constraint(equalToConstant: 32)
footer.heightAnchor.constraint(equalToConstant: 36)
])
}
@@ -159,7 +186,7 @@ final class UninstallReviewController: NSViewController, NSSearchFieldDelegate,
switch selector {
case #selector(NSResponder.moveDown(_:)): moveSelection(1)
case #selector(NSResponder.moveUp(_:)): moveSelection(-1)
case #selector(NSResponder.insertNewline(_:)): confirmUninstall()
case #selector(NSResponder.insertNewline(_:)): toggleHighlighted()
case #selector(NSResponder.cancelOperation(_:)): goBack()
default: return false
}
@@ -390,7 +417,7 @@ private final class UninstallFilesTable: NSTableView {
var toggle: (() -> Void)?
var dismiss: (() -> Void)?
override func keyDown(with event: NSEvent) {
if event.keyCode == 49 { toggle?() }
if [36, 76, 49].contains(event.keyCode), event.modifierFlags.intersection([.command, .option, .control]).isEmpty { toggle?() }
else if event.keyCode == 53 { dismiss?() }
else { super.keyDown(with: event) }
}