Skip to content

Commit a94975b

Browse files
committed
feature: allow to switch between pages switcher and repository command palette
Signed-off-by: leo <longshuang@msn.cn>
1 parent ed4bfb0 commit a94975b

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/Views/Launcher.axaml.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,14 +189,28 @@ protected override async void OnKeyDown(KeyEventArgs e)
189189
}
190190
}
191191

192+
var cmdKey = OperatingSystem.IsMacOS() ? KeyModifiers.Meta : KeyModifiers.Control;
193+
192194
if (vm.CommandPalette != null)
193195
{
194196
if (e.Key == Key.Escape)
197+
{
195198
vm.CommandPalette = null;
199+
e.Handled = true;
200+
}
201+
else if (vm.ActivePage.Data is ViewModels.Repository repo
202+
&& vm.CommandPalette is ViewModels.LauncherPagesCommandPalette
203+
&& e.Key == Key.P
204+
&& e.KeyModifiers == (cmdKey | KeyModifiers.Shift))
205+
{
206+
vm.CommandPalette = new ViewModels.RepositoryCommandPalette(repo);
207+
e.Handled = true;
208+
}
209+
196210
return;
197211
}
198212

199-
if (e.KeyModifiers.HasFlag(OperatingSystem.IsMacOS() ? KeyModifiers.Meta : KeyModifiers.Control))
213+
if (e.KeyModifiers.HasFlag(cmdKey))
200214
{
201215
if (e.Key == Key.W)
202216
{

0 commit comments

Comments
 (0)