Skip to content

Commit 06e2fdc

Browse files
committed
ux!: change the hotkeys to clone/open repository
- Hotkey to clone remote repository: `Ctrl+R`/`⌘+R` (R means remote) - Hotkey to open local repository: `Ctrl+L`/`⌘+L` (L means local) Signed-off-by: leo <longshuang@msn.cn>
1 parent 324e4af commit 06e2fdc

4 files changed

Lines changed: 16 additions & 19 deletions

File tree

src/Resources/Locales/en_US.axaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@
526526
<x:String x:Key="Text.HistoriesDetailsStandalone.RevisionCompare" xml:space="preserve">Revision Compare</x:String>
527527
<x:String x:Key="Text.Hotkeys" xml:space="preserve">Keyboard Shortcuts Reference</x:String>
528528
<x:String x:Key="Text.Hotkeys.Global" xml:space="preserve">GLOBAL</x:String>
529-
<x:String x:Key="Text.Hotkeys.Global.Clone" xml:space="preserve">Clone new repository</x:String>
529+
<x:String x:Key="Text.Hotkeys.Global.Clone" xml:space="preserve">Clone remote repository</x:String>
530530
<x:String x:Key="Text.Hotkeys.Global.CloseTab" xml:space="preserve">Close current tab</x:String>
531531
<x:String x:Key="Text.Hotkeys.Global.GotoNextTab" xml:space="preserve">Go to next tab</x:String>
532532
<x:String x:Key="Text.Hotkeys.Global.GotoPrevTab" xml:space="preserve">Go to previous tab</x:String>

src/Views/Hotkeys.axaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@
6161
<TextBlock Grid.Row="4" Grid.Column="0" Classes="bold" Text="{OnPlatform Ctrl+Tab, macOS=⌘+⌥+→}"/>
6262
<TextBlock Grid.Row="4" Grid.Column="1" Margin="16,0,0,0" Text="{DynamicResource Text.Hotkeys.Global.GotoNextTab}" />
6363

64-
<TextBlock Grid.Row="5" Grid.Column="0" Classes="bold" Text="{OnPlatform Ctrl+N, macOS=⌘+N}"/>
64+
<TextBlock Grid.Row="5" Grid.Column="0" Classes="bold" Text="{OnPlatform Ctrl+R, macOS=⌘+R}"/>
6565
<TextBlock Grid.Row="5" Grid.Column="1" Margin="16,0,0,0" Text="{DynamicResource Text.Hotkeys.Global.Clone}" />
6666

67-
<TextBlock Grid.Row="6" Grid.Column="0" Classes="bold" Text="{OnPlatform Ctrl+L, macOS=⌘+⇧+O}"/>
67+
<TextBlock Grid.Row="6" Grid.Column="0" Classes="bold" Text="{OnPlatform Ctrl+L, macOS=⌘+L}"/>
6868
<TextBlock Grid.Row="6" Grid.Column="1" Margin="16,0,0,0" Text="{DynamicResource Text.Hotkeys.Global.OpenLocalRepository}" />
6969

7070
<TextBlock Grid.Row="7" Grid.Column="0" Classes="bold" Text="{OnPlatform Ctrl+Alt+P, macOS=⌘+⌥+P}"/>

src/Views/Launcher.axaml.cs

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -199,19 +199,6 @@ protected override async void OnKeyDown(KeyEventArgs e)
199199
return;
200200
}
201201

202-
// macOS: Cmd+Shift+O to open local repository, Windows/Linux: Ctrl+L to open local repository.
203-
// It's because that Ctrl+Shift+O doesn't work on Windows/Linux(WSL). The e.Key is parsed as Key.ImeProcessed...
204-
if ((isMacOS && e is { Key: Key.O, KeyModifiers: KeyModifiers.Meta | KeyModifiers.Shift }) ||
205-
(!isMacOS && e is { Key: Key.L, KeyModifiers: KeyModifiers.Control }))
206-
{
207-
if (vm.ActivePage.Data is not ViewModels.Welcome)
208-
vm.AddNewTab();
209-
210-
ViewModels.Welcome.Instance.OpenLocalRepository();
211-
e.Handled = true;
212-
return;
213-
}
214-
215202
if (e.KeyModifiers.HasFlag(cmdKey))
216203
{
217204
if (e.Key == Key.W)
@@ -221,7 +208,7 @@ protected override async void OnKeyDown(KeyEventArgs e)
221208
return;
222209
}
223210

224-
if (e.Key == Key.N)
211+
if (e.Key == Key.R)
225212
{
226213
if (vm.ActivePage.Data is not ViewModels.Welcome)
227214
vm.AddNewTab();
@@ -231,6 +218,16 @@ protected override async void OnKeyDown(KeyEventArgs e)
231218
return;
232219
}
233220

221+
if (e.Key == Key.L)
222+
{
223+
if (vm.ActivePage.Data is not ViewModels.Welcome)
224+
vm.AddNewTab();
225+
226+
ViewModels.Welcome.Instance.OpenLocalRepository();
227+
e.Handled = true;
228+
return;
229+
}
230+
234231
if (e.Key == Key.T && e.KeyModifiers == cmdKey)
235232
{
236233
vm.AddNewTab();

src/Views/WelcomeToolbar.axaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<TextBlock>
1414
<Run Text="{DynamicResource Text.Welcome.Clone}"/>
1515
<Run Text=" "/>
16-
<Run Text="{OnPlatform Ctrl+N, macOS=⌘+N}" FontSize="11" Foreground="{DynamicResource MenuFlyoutItemKeyboardAcceleratorTextForeground}"/>
16+
<Run Text="{OnPlatform Ctrl+R, macOS=⌘+R}" FontSize="11" Foreground="{DynamicResource MenuFlyoutItemKeyboardAcceleratorTextForeground}"/>
1717
</TextBlock>
1818
</ToolTip.Tip>
1919
<Path Width="16" Height="16" Data="{StaticResource Icons.Clone}" Margin="0,4,0,0"/>
@@ -24,7 +24,7 @@
2424
<TextBlock>
2525
<Run Text="{DynamicResource Text.Welcome.OpenOrInit}"/>
2626
<Run Text=" "/>
27-
<Run Text="{OnPlatform Ctrl+L, macOS=⌘+⇧+O}" FontSize="11" Foreground="{DynamicResource MenuFlyoutItemKeyboardAcceleratorTextForeground}"/>
27+
<Run Text="{OnPlatform Ctrl+L, macOS=⌘+L}" FontSize="11" Foreground="{DynamicResource MenuFlyoutItemKeyboardAcceleratorTextForeground}"/>
2828
</TextBlock>
2929
</ToolTip.Tip>
3030
<Path Width="14" Height="14" Data="{StaticResource Icons.Folder.Open}" Margin="0,2,0,0"/>

0 commit comments

Comments
 (0)