From 0938ccc98f3369847705e44b1ce7746663822ab8 Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 7 Jul 2025 13:10:12 +0800 Subject: [PATCH] feature!: change hotkeys - change the hotkey to create branch based on selected commit to `Ctrl+Shift+B` - add a new hotkey to create tag based on selected commit to `Ctrl+Shift+T` Signed-off-by: leo --- src/Resources/Locales/de_DE.axaml | 1 - src/Resources/Locales/en_US.axaml | 1 - src/Resources/Locales/es_ES.axaml | 1 - src/Resources/Locales/fr_FR.axaml | 1 - src/Resources/Locales/it_IT.axaml | 1 - src/Resources/Locales/ja_JP.axaml | 1 - src/Resources/Locales/pt_BR.axaml | 1 - src/Resources/Locales/ru_RU.axaml | 1 - src/Resources/Locales/ta_IN.axaml | 1 - src/Resources/Locales/uk_UA.axaml | 1 - src/Resources/Locales/zh_CN.axaml | 1 - src/Resources/Locales/zh_TW.axaml | 1 - src/ViewModels/Histories.cs | 3 ++- src/Views/Histories.axaml.cs | 23 ++++++++++++++++++----- src/Views/Hotkeys.axaml | 9 +++------ src/Views/Launcher.axaml.cs | 2 +- src/Views/WelcomeToolbar.axaml | 9 ++++++++- 17 files changed, 32 insertions(+), 26 deletions(-) diff --git a/src/Resources/Locales/de_DE.axaml b/src/Resources/Locales/de_DE.axaml index 99e5f12d..3b73f83f 100644 --- a/src/Resources/Locales/de_DE.axaml +++ b/src/Resources/Locales/de_DE.axaml @@ -424,7 +424,6 @@ Gestagte Änderungen committen Gestagte Änderungen committen und pushen Alle Änderungen stagen und committen - Neuen Branch basierend auf ausgewählten Commit erstellen Ausgewählte Änderungen verwerfen Fetch, wird direkt ausgeführt Dashboard Modus (Standard) diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 65b02cb5..9e487743 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -424,7 +424,6 @@ Commit staged changes Commit and push staged changes Stage all changes and commit - Creates a new branch based on selected commit Discard selected changes Fetch, starts directly Dashboard mode (Default) diff --git a/src/Resources/Locales/es_ES.axaml b/src/Resources/Locales/es_ES.axaml index 8654e5ed..4e8948d9 100644 --- a/src/Resources/Locales/es_ES.axaml +++ b/src/Resources/Locales/es_ES.axaml @@ -421,7 +421,6 @@ Commit cambios staged Commit y push cambios staged Stage todos los cambios y commit - Crea una nueva rama basada en el commit seleccionado Descartar cambios seleccionados Fetch, empieza directamente Modo Dashboard (Por Defecto) diff --git a/src/Resources/Locales/fr_FR.axaml b/src/Resources/Locales/fr_FR.axaml index 55de07a2..3f790718 100644 --- a/src/Resources/Locales/fr_FR.axaml +++ b/src/Resources/Locales/fr_FR.axaml @@ -370,7 +370,6 @@ Commit les changements de l'index Commit et pousser les changements de l'index Ajouter tous les changements et commit - Créer une nouvelle branche basée sur le commit actuel Rejeter les changements sélectionnés Fetch, démarre directement Mode tableau de bord (Défaut) diff --git a/src/Resources/Locales/it_IT.axaml b/src/Resources/Locales/it_IT.axaml index 9b2102b6..e8822ac7 100644 --- a/src/Resources/Locales/it_IT.axaml +++ b/src/Resources/Locales/it_IT.axaml @@ -389,7 +389,6 @@ Committa le modifiche in tsage Committa e invia le modifiche in stage Fai lo stage di tutte le modifiche e committa - Crea un nuovo branch dal commit selezionato Scarta le modifiche selezionate Recupera, avvia direttamente Modalità Dashboard (Predefinita) diff --git a/src/Resources/Locales/ja_JP.axaml b/src/Resources/Locales/ja_JP.axaml index 3780ffdc..c8bdf719 100644 --- a/src/Resources/Locales/ja_JP.axaml +++ b/src/Resources/Locales/ja_JP.axaml @@ -369,7 +369,6 @@ ステージ済みの変更をコミット ステージ済みの変更をコミットしてプッシュ 全ての変更をステージしてコミット - 選択中のコミットから新たなブランチを作成 選択した変更を破棄 直接フェッチを実行 ダッシュボードモード (初期値) diff --git a/src/Resources/Locales/pt_BR.axaml b/src/Resources/Locales/pt_BR.axaml index 75da3552..139a9ed7 100644 --- a/src/Resources/Locales/pt_BR.axaml +++ b/src/Resources/Locales/pt_BR.axaml @@ -341,7 +341,6 @@ Commitar mudanças preparadas Commitar e enviar mudanças preparadas Preparar todas as mudanças e commitar - Cria um novo branch partindo do commit selecionado Descartar mudanças selecionadas Buscar, imediatamente Modo de Dashboard (Padrão) diff --git a/src/Resources/Locales/ru_RU.axaml b/src/Resources/Locales/ru_RU.axaml index 7d5b932b..9852ee95 100644 --- a/src/Resources/Locales/ru_RU.axaml +++ b/src/Resources/Locales/ru_RU.axaml @@ -428,7 +428,6 @@ Зафиксировать сформированные изменения Зафиксировать и выложить сформированные изменения Сформировать все изменения и зафиксировать - Создать новую ветку на основе выбранной ветки Отклонить выбранные изменения Извлечение, запускается сразу Режим доски (по умолчанию) diff --git a/src/Resources/Locales/ta_IN.axaml b/src/Resources/Locales/ta_IN.axaml index d6f2ff44..a2115f7a 100644 --- a/src/Resources/Locales/ta_IN.axaml +++ b/src/Resources/Locales/ta_IN.axaml @@ -369,7 +369,6 @@ நிலைபடுத்திய மாற்றங்களை உறுதிமொழி நிலைபடுத்திய மாற்றங்களை உறுதிமொழி மற்றும் தள்ளு அனைத்து மாற்றங்களையும் நிலைபடுத்தி உறுதிமொழி - தேர்ந்தெடுக்கப்பட்ட உறுதிமொழியின் அடிப்படையில் ஒரு புதிய கிளையை உருவாக்குகிறது தேர்ந்தெடுக்கப்பட்ட மாற்றங்களை நிராகரி எடு, நேரடியாகத் தொடங்குகிறது முகப்பலகை பயன்முறை (இயல்புநிலை) diff --git a/src/Resources/Locales/uk_UA.axaml b/src/Resources/Locales/uk_UA.axaml index 393eea74..ebd32734 100644 --- a/src/Resources/Locales/uk_UA.axaml +++ b/src/Resources/Locales/uk_UA.axaml @@ -374,7 +374,6 @@ Закомітити проіндексовані зміни Закомітити та надіслати проіндексовані зміни Індексувати всі зміни та закомітити - Створити нову гілку на основі вибраного коміту Скасувати вибрані зміни Fetch, запускається без діалогу Режим панелі керування (за замовчуванням) diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index 7fc02833..7fd7b666 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -428,7 +428,6 @@ 提交暂存区更改 提交暂存区更改并推送 自动暂存全部变更并提交 - 基于选中提交创建新分支 丢弃选中的更改 拉取 (fetch) 远程变更 切换左边栏为分支/标签等显示模式(默认) diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index 63273cb0..ef6e0ab4 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -428,7 +428,6 @@ 提交暫存區變更 提交暫存區變更並推送 自動暫存全部變更並提交 - 基於選取的提交建立新分支 捨棄選取的變更 提取 (fetch) 遠端的變更 切換左邊欄為分支/標籤等顯示模式 (預設) diff --git a/src/ViewModels/Histories.cs b/src/ViewModels/Histories.cs index 4d7f42e9..e98c6f9f 100644 --- a/src/ViewModels/Histories.cs +++ b/src/ViewModels/Histories.cs @@ -725,7 +725,7 @@ namespace SourceGit.ViewModels var createBranch = new MenuItem(); createBranch.Icon = App.CreateMenuIcon("Icons.Branch.Add"); createBranch.Header = App.Text("CreateBranch"); - createBranch.Tag = OperatingSystem.IsMacOS() ? "⌘+B" : "Ctrl+B"; + createBranch.Tag = OperatingSystem.IsMacOS() ? "⌘+⇧+B" : "Ctrl+Shift+B"; createBranch.Click += (_, e) => { if (_repo.CanCreatePopup()) @@ -737,6 +737,7 @@ namespace SourceGit.ViewModels var createTag = new MenuItem(); createTag.Icon = App.CreateMenuIcon("Icons.Tag.Add"); createTag.Header = App.Text("CreateTag"); + createTag.Tag = OperatingSystem.IsMacOS() ? "⌘+⇧+T" : "Ctrl+Shift+T"; createTag.Click += (_, e) => { if (_repo.CanCreatePopup()) diff --git a/src/Views/Histories.axaml.cs b/src/Views/Histories.axaml.cs index b33756a3..db31ea09 100644 --- a/src/Views/Histories.axaml.cs +++ b/src/Views/Histories.axaml.cs @@ -213,10 +213,8 @@ namespace SourceGit.Views if (!e.KeyModifiers.HasFlag(OperatingSystem.IsMacOS() ? KeyModifiers.Meta : KeyModifiers.Control)) return; - // These shortcuts are not mentioned in the Shortcut Reference window. Is this expected? if (sender is DataGrid { SelectedItems: { Count: > 0 } selected }) { - // CTRL/COMMAND + C -> Copy selected commit SHA and subject. if (e.Key == Key.C) { var builder = new StringBuilder(); @@ -231,11 +229,9 @@ namespace SourceGit.Views return; } - // CTRL/COMMAND + B -> shows Create Branch pop-up at selected commit. - if (e.Key == Key.B) + if (e.Key == Key.B && e.KeyModifiers.HasFlag(KeyModifiers.Shift)) { var repoView = this.FindAncestorOfType(); - if (repoView?.DataContext is not ViewModels.Repository repo || !repo.CanCreatePopup()) return; @@ -244,6 +240,23 @@ namespace SourceGit.Views repo.ShowPopup(new ViewModels.CreateBranch(repo, commit)); e.Handled = true; } + + return; + } + + if (e.Key == Key.T && e.KeyModifiers.HasFlag(KeyModifiers.Shift)) + { + var repoView = this.FindAncestorOfType(); + if (repoView?.DataContext is not ViewModels.Repository repo || !repo.CanCreatePopup()) + return; + + if (selected.Count == 1 && selected[0] is Models.Commit commit) + { + repo.ShowPopup(new ViewModels.CreateTag(repo, commit)); + e.Handled = true; + } + + return; } } } diff --git a/src/Views/Hotkeys.axaml b/src/Views/Hotkeys.axaml index d87ccd14..5ca02597 100644 --- a/src/Views/Hotkeys.axaml +++ b/src/Views/Hotkeys.axaml @@ -83,7 +83,7 @@ FontSize="{Binding Source={x:Static vm:Preferences.Instance}, Path=DefaultFontSize, Converter={x:Static c:DoubleConverters.Increase}}" Margin="0,8"/> - + @@ -123,11 +123,8 @@ - - - - - + + -