diff --git a/src/App.axaml b/src/App.axaml index 73b97017..186022d5 100644 --- a/src/App.axaml +++ b/src/App.axaml @@ -35,7 +35,7 @@ - + diff --git a/src/Views/Hotkeys.axaml.cs b/src/Views/Hotkeys.axaml.cs index d8b5e1a8..ea293b0a 100644 --- a/src/Views/Hotkeys.axaml.cs +++ b/src/Views/Hotkeys.axaml.cs @@ -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(); + } } } diff --git a/src/Views/Launcher.axaml.cs b/src/Views/Launcher.axaml.cs index c19e6bdd..84364ee0 100644 --- a/src/Views/Launcher.axaml.cs +++ b/src/Views/Launcher.axaml.cs @@ -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) {