From 31f85dfaffb37622ad7d665c391352c3ffdf772e Mon Sep 17 00:00:00 2001 From: iuhoay Date: Sun, 14 Jun 2026 16:41:44 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E2=8C=98Y=20/=20=E2=8C=98P=20shortcuts?= =?UTF-8?q?=20for=20history=20and=20pin=20on=20the=20translate=20window?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Round out the translation window's keyboard story: the toolbar's two remaining mouse-only controls now have shortcuts. - ⌘Y toggles the translation history (the de-facto macOS history shortcut — Safari, Finder). - ⌘P pins/unpins the window. Both bind directly on the visible toolbar buttons (like the Run button's ⌘↵) rather than the hidden shortcut group, so they still fire while the TextEditor holds focus and stay self-documenting. Each tooltip now shows its shortcut, and the pin tooltip reflects state ("Pin"/"Unpin window"). ⌘H is deliberately avoided — it's the system "Hide application" shortcut. The bare "Pin window" string is replaced by the two stateful tooltip keys; "Translation History" stays since the window title, nav title, and menu item still use it. Co-Authored-By: Claude Opus 4.8 (1M context) --- CHANGELOG.md | 2 ++ mac-app/Lumo/Localizable.xcstrings | 24 ++++++++++++++++++++++-- mac-app/Lumo/Views/TranslationView.swift | 9 +++++++-- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 98dd451..3fc8b34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Keyboard-first translation window: ⌘1 / ⌘2 / ⌘3 switch between Translate, Polish, and Summary, and ⌘R regenerates the current result. Each mode segment shows its shortcut hint. +- ⌘Y opens the translation history and ⌘P pins/unpins the window, matching the + toolbar buttons; both shortcuts are shown in the buttons' tooltips. - Markdown tables in results now render as a bordered grid instead of raw `| --- |` pipe-and-dash text. All other output stays as plain, selectable, copyable text. diff --git a/mac-app/Lumo/Localizable.xcstrings b/mac-app/Lumo/Localizable.xcstrings index 3a95a10..40f6ede 100644 --- a/mac-app/Lumo/Localizable.xcstrings +++ b/mac-app/Lumo/Localizable.xcstrings @@ -231,12 +231,12 @@ } } }, - "Pin window" : { + "Pin window (⌘P)" : { "localizations" : { "zh-Hans" : { "stringUnit" : { "state" : "translated", - "value" : "置顶窗口" + "value" : "置顶窗口(⌘P)" } } } @@ -511,6 +511,16 @@ } } }, + "Translation History (⌘Y)" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "翻译历史(⌘Y)" + } + } + } + }, "Translation History…" : { "localizations" : { "zh-Hans" : { @@ -521,6 +531,16 @@ } } }, + "Unpin window (⌘P)" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "取消置顶(⌘P)" + } + } + } + }, "View on GitHub" : { "localizations" : { "zh-Hans" : { diff --git a/mac-app/Lumo/Views/TranslationView.swift b/mac-app/Lumo/Views/TranslationView.swift index 358d1ba..438c79c 100644 --- a/mac-app/Lumo/Views/TranslationView.swift +++ b/mac-app/Lumo/Views/TranslationView.swift @@ -125,12 +125,17 @@ struct TranslationView: View { Button { HistoryWindowController.shared.toggle() } label: { Image(systemName: "clock.arrow.circlepath") } - .help("Translation History") + // ⌘Y is the de-facto macOS history shortcut (Safari, Finder). Like + // the Run button, this visible control carries its shortcut directly + // and still fires while the TextEditor holds focus. + .keyboardShortcut("y", modifiers: .command) + .help("Translation History (⌘Y)") Button { model.togglePin() } label: { Image(systemName: model.isPinned ? "pin.fill" : "pin") } - .help("Pin window") + .keyboardShortcut("p", modifiers: .command) + .help(model.isPinned ? "Unpin window (⌘P)" : "Pin window (⌘P)") Button { model.dismiss() } label: { Image(systemName: "xmark")