diff --git a/src/Views/Launcher.axaml.cs b/src/Views/Launcher.axaml.cs index aa184cf2..4b5b2889 100644 --- a/src/Views/Launcher.axaml.cs +++ b/src/Views/Launcher.axaml.cs @@ -3,6 +3,7 @@ using System; using Avalonia; using Avalonia.Controls; using Avalonia.Input; +using Avalonia.VisualTree; namespace SourceGit.Views { @@ -160,6 +161,19 @@ namespace SourceGit.Views return; } } + else + { + var welcome = this.FindDescendantOfType(); + if (welcome != null) + { + if (e.Key == Key.F) + { + welcome.SearchBox.Focus(); + e.Handled = true; + return; + } + } + } } else if (e.Key == Key.Escape) { diff --git a/src/Views/Welcome.axaml.cs b/src/Views/Welcome.axaml.cs index e4a329e8..9e887ab0 100644 --- a/src/Views/Welcome.axaml.cs +++ b/src/Views/Welcome.axaml.cs @@ -45,13 +45,6 @@ namespace SourceGit.Views TreeContainer.Focus(NavigationMethod.Directional); e.Handled = true; } - else if (e.Key == Key.F && - ((OperatingSystem.IsMacOS() && e.KeyModifiers.HasFlag(KeyModifiers.Meta)) || - (!OperatingSystem.IsMacOS() && e.KeyModifiers.HasFlag(KeyModifiers.Control)))) - { - SearchBox.Focus(); - e.Handled = true; - } else if (e.Key == Key.Escape) { ViewModels.Welcome.Instance.ClearSearchFilter();