feat: copy translation and dismiss with Return

This commit is contained in:
2026-10-17 23:21:51 +02:00
parent 9eb16ddd5a
commit 038a5b78a0
4 changed files with 67 additions and 8 deletions
@@ -499,7 +499,7 @@ final class LauncherWindowController: NSWindowController, NSWindowDelegate, NSSe
}
if let emojiPicker { return emojiPicker.handle(commandSelector) }
if let translation {
if commandSelector == #selector(NSResponder.insertNewline(_:)) { translation.translate(); return true }
if commandSelector == #selector(NSResponder.insertNewline(_:)) { translation.performPrimaryAction(); return true }
return false
}
switch commandSelector {
@@ -835,7 +835,8 @@ final class LauncherWindowController: NSWindowController, NSWindowDelegate, NSSe
let accessibilityLabel: String
switch command {
case .translate:
let tool = TranslationController()
let tool = TranslationController(pasteboard: pasteboard)
tool.dismiss = { [weak self] in self?.dismiss() }
translation = tool
tool.input = { [weak self] in self?.searchField.stringValue ?? "" }
controller = tool