feature: use F1 to quick open the Keyboard Shortcuts Reference dialog (#1225)

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2025-04-22 10:30:19 +08:00
parent 9f18cbca5b
commit 4c3698b171
No known key found for this signature in database
3 changed files with 18 additions and 1 deletions

View file

@ -1,3 +1,5 @@
using Avalonia.Input;
namespace SourceGit.Views
{
public partial class Hotkeys : ChromelessWindow
@ -6,5 +8,13 @@ namespace SourceGit.Views
{
InitializeComponent();
}
protected override void OnKeyDown(KeyEventArgs e)
{
base.OnKeyDown(e);
if (!e.Handled && e.Key == Key.Escape)
Close();
}
}
}

View file

@ -141,6 +141,13 @@ namespace SourceGit.Views
return;
}
// F1 opens preference dialog (macOS use hotkeys in system menu bar)
if (!OperatingSystem.IsMacOS() && e.Key == Key.F1)
{
App.ShowWindow(new Hotkeys(), true);
return;
}
// Ctrl+Q quits the application (macOS use hotkeys in system menu bar)
if (!OperatingSystem.IsMacOS() && e.KeyModifiers == KeyModifiers.Control && e.Key == Key.Q)
{