From 3fffb0b2290e7959dd75b690a9bbd1d3179a13aa Mon Sep 17 00:00:00 2001 From: leo Date: Sat, 11 May 2024 18:06:31 +0800 Subject: [PATCH] =?UTF-8?q?feature:=20add=20hotkeys=20`Ctrl+Shift+P`=20(on?= =?UTF-8?q?=20Windows/Linux)=20and=20`=E2=8C=98+,`=20(on=20macOS)=20to=20o?= =?UTF-8?q?pen=20`Preference`=20dialog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Resources/Locales/en_US.axaml | 1 + src/Resources/Locales/zh_CN.axaml | 1 + src/Views/Hotkeys.axaml | 25 ++++++++++++++----------- src/Views/Launcher.axaml | 2 +- src/Views/Launcher.axaml.cs | 9 +++++++++ 5 files changed, 26 insertions(+), 12 deletions(-) diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index b40171d4..b095a6a9 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -218,6 +218,7 @@ Go to previous page Go to next page Create new page + Open preference dialog REPOSITORY Force to reload this repository Stage/Unstage selected changes diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index a1f69711..1c972de5 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -218,6 +218,7 @@ 切换到上一个页面 切换到下一个页面 新建页面 + 打开偏好设置面板 仓库页面快捷键 重新加载仓库状态 将选中的变更暂存或从暂存列表中移除 diff --git a/src/Views/Hotkeys.axaml b/src/Views/Hotkeys.axaml index 96f0a9a2..79a06cb7 100644 --- a/src/Views/Hotkeys.axaml +++ b/src/Views/Hotkeys.axaml @@ -67,21 +67,24 @@ FontSize="{Binding Source={x:Static vm:Preference.Instance}, Path=DefaultFontSize, Converter={x:Static c:FontSizeModifyConverters.Increase}}" Margin="0,0,0,8"/> - - - + + + + + + - - + + - - + + - - + + - - + + - + diff --git a/src/Views/Launcher.axaml.cs b/src/Views/Launcher.axaml.cs index 905f4207..308cf0b6 100644 --- a/src/Views/Launcher.axaml.cs +++ b/src/Views/Launcher.axaml.cs @@ -98,6 +98,15 @@ namespace SourceGit.Views protected override void OnKeyDown(KeyEventArgs e) { var vm = DataContext as ViewModels.Launcher; + + // Ctrl+Shift+P opens preference dialog (macOS use hotkeys in system menu bar) + if (!OperatingSystem.IsMacOS() && e.KeyModifiers == (KeyModifiers.Control | KeyModifiers.Shift) && e.Key == Key.P) + { + App.OpenPreferenceCommand.Execute(null); + e.Handled = true; + return; + } + if ((OperatingSystem.IsMacOS() && e.KeyModifiers.HasFlag(KeyModifiers.Meta)) || (!OperatingSystem.IsMacOS() && e.KeyModifiers.HasFlag(KeyModifiers.Control))) {