Skip to content

Commit fe57dd7

Browse files
committed
fix: we can only use Ctrl+` on macOS
Signed-off-by: leo <longshuang@msn.cn>
1 parent 6d79441 commit fe57dd7

2 files changed

Lines changed: 13 additions & 10 deletions

File tree

‎src/Views/Hotkeys.axaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
<TextBlock Grid.Row="9" Grid.Column="0" Classes="bold" Text="{OnPlatform 'Ctrl+-/=', macOS='⌘+-/='}"/>
7777
<TextBlock Grid.Row="9" Grid.Column="1" Margin="16,0,0,0" Text="{DynamicResource Text.Hotkeys.Global.Zoom}" />
7878

79-
<TextBlock Grid.Row="10" Grid.Column="0" Classes="bold" Text="{OnPlatform Ctrl+`, macOS=⌘+`}"/>
79+
<TextBlock Grid.Row="10" Grid.Column="0" Classes="bold" Text="Ctrl+`"/>
8080
<TextBlock Grid.Row="10" Grid.Column="1" Margin="16,0,0,0" Text="{DynamicResource Text.Welcome.OpenTerminal}" />
8181

8282
<TextBlock Grid.Row="11" Grid.Column="0" Classes="bold" Text="{OnPlatform Ctrl+Q, macOS=⌘+Q}"/>

‎src/Views/Launcher.axaml.cs‎

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,18 @@ protected override async void OnKeyDown(KeyEventArgs e)
178178
}
179179
}
180180

181+
// Ctrl+` to open terminal. On macOS, Cmd+` is used to switch between windows
182+
if (e is { Key: Key.OemTilde, KeyModifiers: KeyModifiers.Control })
183+
{
184+
if (vm.ActivePage.Data is ViewModels.Repository repo)
185+
Native.OS.OpenTerminal(repo.FullPath);
186+
else
187+
ViewModels.Welcome.Instance.OpenTerminal();
188+
189+
e.Handled = true;
190+
return;
191+
}
192+
181193
var cmdKey = OperatingSystem.IsMacOS() ? KeyModifiers.Meta : KeyModifiers.Control;
182194

183195
if (vm.CommandPalette != null)
@@ -279,17 +291,8 @@ protected override async void OnKeyDown(KeyEventArgs e)
279291
vm.CommandPalette = new ViewModels.RepositoryCommandPalette(repo);
280292
e.Handled = true;
281293
return;
282-
case Key.OemTilde:
283-
Native.OS.OpenTerminal(repo.FullPath);
284-
e.Handled = true;
285-
return;
286294
}
287295
}
288-
else if (e.Key == Key.OemTilde)
289-
{
290-
ViewModels.Welcome.Instance.OpenTerminal();
291-
e.Handled = true;
292-
}
293296
}
294297
else if (e.Key == Key.Escape)
295298
{

0 commit comments

Comments
 (0)