Skip to content

Commit d50b2c0

Browse files
committed
code_review: PR #657
* add hotkey `Ctrl+Down/⌘+Down` to fetch directly * keep translation keys of en_US in order * add translations for zh_CN and zh_TW * do NOT using namespace under `SourceGit` * use `⇧` instead of `Shift` in hotkey tips * hotkey mismatch on macOS * hotkeys to start fetch/pull/push directly not work on macOS * remove the hotkey of `Create Branch` context menu item - there are other objects (such as branch and tag) also have the `Create Branch` context menu item without hotkeys - on macOS, we already use `⌘+B` to create branch with selected commit, not `Ctrl + B` Signed-off-by: leo <[email protected]>
1 parent dc49c1b commit d50b2c0

File tree

10 files changed

+84
-49
lines changed

10 files changed

+84
-49
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
4848
## Translation Status
4949

50-
[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-95.22%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-99.57%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-86.96%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-90.00%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-99.13%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-99.57%25-yellow)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-99.57%25-yellow)](TRANSLATION.md)
50+
[![en_US](https://img.shields.io/badge/en__US-100%25-brightgreen)](TRANSLATION.md) [![de__DE](https://img.shields.io/badge/de__DE-95.08%25-yellow)](TRANSLATION.md) [![es__ES](https://img.shields.io/badge/es__ES-99.42%25-yellow)](TRANSLATION.md) [![fr__FR](https://img.shields.io/badge/fr__FR-86.83%25-yellow)](TRANSLATION.md) [![pt__BR](https://img.shields.io/badge/pt__BR-89.87%25-yellow)](TRANSLATION.md) [![ru__RU](https://img.shields.io/badge/ru__RU-98.99%25-yellow)](TRANSLATION.md) [![zh__CN](https://img.shields.io/badge/zh__CN-100.00%25-brightgreen)](TRANSLATION.md) [![zh__TW](https://img.shields.io/badge/zh__TW-100.00%25-brightgreen)](TRANSLATION.md)
5151

5252
## How to Use
5353

TRANSLATION.md

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
### de_DE.axaml: 95.22%
1+
### de_DE.axaml: 95.08%
22

33

44
<details>
@@ -25,9 +25,10 @@
2525
- Text.Diff.VisualLines.All
2626
- Text.ExecuteCustomAction
2727
- Text.ExecuteCustomAction.Name
28+
- Text.Hotkeys.Repo.CreateBranchOnCommit
29+
- Text.Hotkeys.Repo.Fetch
2830
- Text.Hotkeys.Repo.Pull
2931
- Text.Hotkeys.Repo.Push
30-
- Text.Hotkeys.Repo.CreateBranchOnCommit
3132
- Text.IssueLinkCM.OpenInBrowser
3233
- Text.IssueLinkCM.CopyLink
3334
- Text.Preference.AI.AnalyzeDiffPrompt
@@ -40,19 +41,20 @@
4041

4142
</details>
4243

43-
### es_ES.axaml: 99.57%
44+
### es_ES.axaml: 99.42%
4445

4546

4647
<details>
4748
<summary>Missing Keys</summary>
4849

50+
- Text.Hotkeys.Repo.CreateBranchOnCommit
51+
- Text.Hotkeys.Repo.Fetch
4952
- Text.Hotkeys.Repo.Pull
5053
- Text.Hotkeys.Repo.Push
51-
- Text.Hotkeys.Repo.CreateBranchOnCommit
5254

5355
</details>
5456

55-
### fr_FR.axaml: 86.96%
57+
### fr_FR.axaml: 86.83%
5658

5759

5860
<details>
@@ -108,10 +110,11 @@
108110
- Text.Histories.Tips.MacOS
109111
- Text.Histories.Tips.Prefix
110112
- Text.Hotkeys.Repo.CommitWithAutoStage
113+
- Text.Hotkeys.Repo.CreateBranchOnCommit
111114
- Text.Hotkeys.Repo.DiscardSelected
115+
- Text.Hotkeys.Repo.Fetch
112116
- Text.Hotkeys.Repo.Pull
113117
- Text.Hotkeys.Repo.Push
114-
- Text.Hotkeys.Repo.CreateBranchOnCommit
115118
- Text.IssueLinkCM.OpenInBrowser
116119
- Text.IssueLinkCM.CopyLink
117120
- Text.MoveRepositoryNode
@@ -151,7 +154,7 @@
151154

152155
</details>
153156

154-
### pt_BR.axaml: 90.00%
157+
### pt_BR.axaml: 89.87%
155158

156159

157160
<details>
@@ -205,9 +208,10 @@
205208
- Text.FileHistory.FileContent
206209
- Text.FileHistory.FileChange
207210
- Text.GitLFS.Locks.OnlyMine
211+
- Text.Hotkeys.Repo.CreateBranchOnCommit
212+
- Text.Hotkeys.Repo.Fetch
208213
- Text.Hotkeys.Repo.Pull
209214
- Text.Hotkeys.Repo.Push
210-
- Text.Hotkeys.Repo.CreateBranchOnCommit
211215
- Text.IssueLinkCM.OpenInBrowser
212216
- Text.IssueLinkCM.CopyLink
213217
- Text.MoveRepositoryNode
@@ -229,41 +233,38 @@
229233

230234
</details>
231235

232-
### ru_RU.axaml: 99.13%
236+
### ru_RU.axaml: 98.99%
233237

234238

235239
<details>
236240
<summary>Missing Keys</summary>
237241

238242
- Text.Diff.VisualLines.All
243+
- Text.Hotkeys.Repo.CreateBranchOnCommit
244+
- Text.Hotkeys.Repo.Fetch
239245
- Text.Hotkeys.Repo.Pull
240246
- Text.Hotkeys.Repo.Push
241-
- Text.Hotkeys.Repo.CreateBranchOnCommit
242247
- Text.IssueLinkCM.OpenInBrowser
243248
- Text.IssueLinkCM.CopyLink
244249

245250
</details>
246251

247-
### zh_CN.axaml: 99.57%
252+
### zh_CN.axaml: 100.00%
248253

249254

250255
<details>
251256
<summary>Missing Keys</summary>
252257

253-
- Text.Hotkeys.Repo.Pull
254-
- Text.Hotkeys.Repo.Push
255-
- Text.Hotkeys.Repo.CreateBranchOnCommit
258+
256259

257260
</details>
258261

259-
### zh_TW.axaml: 99.57%
262+
### zh_TW.axaml: 100.00%
260263

261264

262265
<details>
263266
<summary>Missing Keys</summary>
264267

265-
- Text.Hotkeys.Repo.Pull
266-
- Text.Hotkeys.Repo.Push
267-
- Text.Hotkeys.Repo.CreateBranchOnCommit
268+
268269

269270
</details>

src/Resources/Locales/en_US.axaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,17 +363,18 @@
363363
<x:String x:Key="Text.Hotkeys.Repo.Commit" xml:space="preserve">Commit staged changes</x:String>
364364
<x:String x:Key="Text.Hotkeys.Repo.CommitAndPush" xml:space="preserve">Commit and push staged changes</x:String>
365365
<x:String x:Key="Text.Hotkeys.Repo.CommitWithAutoStage" xml:space="preserve">Stage all changes and commit</x:String>
366+
<x:String x:Key="Text.Hotkeys.Repo.CreateBranchOnCommit" xml:space="preserve">Creates a new branch based on selected commit</x:String>
366367
<x:String x:Key="Text.Hotkeys.Repo.DiscardSelected" xml:space="preserve">Discard selected changes</x:String>
368+
<x:String x:Key="Text.Hotkeys.Repo.Fetch" xml:space="preserve">Fetch, starts directly</x:String>
367369
<x:String x:Key="Text.Hotkeys.Repo.GoHome" xml:space="preserve">Dashboard mode (Default)</x:String>
370+
<x:String x:Key="Text.Hotkeys.Repo.Pull" xml:space="preserve">Pull, starts directly</x:String>
371+
<x:String x:Key="Text.Hotkeys.Repo.Push" xml:space="preserve">Push, starts directly</x:String>
368372
<x:String x:Key="Text.Hotkeys.Repo.Refresh" xml:space="preserve">Force to reload this repository</x:String>
369373
<x:String x:Key="Text.Hotkeys.Repo.StageOrUnstageSelected" xml:space="preserve">Stage/Unstage selected changes</x:String>
370374
<x:String x:Key="Text.Hotkeys.Repo.OpenSearchCommits" xml:space="preserve">Commit search mode</x:String>
371375
<x:String x:Key="Text.Hotkeys.Repo.ViewChanges" xml:space="preserve">Switch to 'Changes'</x:String>
372376
<x:String x:Key="Text.Hotkeys.Repo.ViewHistories" xml:space="preserve">Switch to 'Histories'</x:String>
373377
<x:String x:Key="Text.Hotkeys.Repo.ViewStashes" xml:space="preserve">Switch to 'Stashes'</x:String>
374-
<x:String x:Key="Text.Hotkeys.Repo.Pull" xml:space="preserve">Pull, starts directly</x:String>
375-
<x:String x:Key="Text.Hotkeys.Repo.Push" xml:space="preserve">Push, starts directly</x:String>
376-
<x:String x:Key="Text.Hotkeys.Repo.CreateBranchOnCommit" xml:space="preserve">Creates a new branch based on selected commit</x:String>
377378
<x:String x:Key="Text.Hotkeys.TextEditor" xml:space="preserve">TEXT EDITOR</x:String>
378379
<x:String x:Key="Text.Hotkeys.TextEditor.CloseSearch" xml:space="preserve">Close search panel</x:String>
379380
<x:String x:Key="Text.Hotkeys.TextEditor.GotoNextMatch" xml:space="preserve">Find next match</x:String>

src/Resources/Locales/zh_CN.axaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,12 @@
366366
<x:String x:Key="Text.Hotkeys.Repo.Commit" xml:space="preserve">提交暂存区更改</x:String>
367367
<x:String x:Key="Text.Hotkeys.Repo.CommitAndPush" xml:space="preserve">提交暂存区更改并推送</x:String>
368368
<x:String x:Key="Text.Hotkeys.Repo.CommitWithAutoStage" xml:space="preserve">自动暂存全部变更并提交</x:String>
369+
<x:String x:Key="Text.Hotkeys.Repo.CreateBranchOnCommit" xml:space="preserve">基于选中提交创建新分支</x:String>
369370
<x:String x:Key="Text.Hotkeys.Repo.DiscardSelected" xml:space="preserve">丢弃选中的更改</x:String>
371+
<x:String x:Key="Text.Hotkeys.Repo.Fetch" xml:space="preserve">拉取 (fetch) 远程变更</x:String>
370372
<x:String x:Key="Text.Hotkeys.Repo.GoHome" xml:space="preserve">切换左边栏为分支/标签等显示模式(默认)</x:String>
373+
<x:String x:Key="Text.Hotkeys.Repo.Pull" xml:space="preserve">拉回 (pull) 远程变更</x:String>
374+
<x:String x:Key="Text.Hotkeys.Repo.Push" xml:space="preserve">推送本地变更到远程</x:String>
371375
<x:String x:Key="Text.Hotkeys.Repo.Refresh" xml:space="preserve">重新加载仓库状态</x:String>
372376
<x:String x:Key="Text.Hotkeys.Repo.StageOrUnstageSelected" xml:space="preserve">将选中的变更暂存或从暂存列表中移除</x:String>
373377
<x:String x:Key="Text.Hotkeys.Repo.OpenSearchCommits" xml:space="preserve">切换左边栏为提交搜索模式</x:String>

src/Resources/Locales/zh_TW.axaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,12 @@
366366
<x:String x:Key="Text.Hotkeys.Repo.Commit" xml:space="preserve">提交暫存區變更</x:String>
367367
<x:String x:Key="Text.Hotkeys.Repo.CommitAndPush" xml:space="preserve">提交暫存區變更並推送</x:String>
368368
<x:String x:Key="Text.Hotkeys.Repo.CommitWithAutoStage" xml:space="preserve">自動暫存全部變更並提交</x:String>
369+
<x:String x:Key="Text.Hotkeys.Repo.CreateBranchOnCommit" xml:space="preserve">根據選取的提交建立新的分支</x:String>
369370
<x:String x:Key="Text.Hotkeys.Repo.DiscardSelected" xml:space="preserve">捨棄選取的變更</x:String>
371+
<x:String x:Key="Text.Hotkeys.Repo.Fetch" xml:space="preserve">提取 (fetch) 遠端的變更</x:String>
370372
<x:String x:Key="Text.Hotkeys.Repo.GoHome" xml:space="preserve">切換左邊欄為分支/標籤等顯示模式 (預設)</x:String>
373+
<x:String x:Key="Text.Hotkeys.Repo.Pull" xml:space="preserve">拉取 (pull) 遠端的變更</x:String>
374+
<x:String x:Key="Text.Hotkeys.Repo.Push" xml:space="preserve">推送 (push) 本地變更到遠端存放庫</x:String>
371375
<x:String x:Key="Text.Hotkeys.Repo.Refresh" xml:space="preserve">強制重新載入存放庫</x:String>
372376
<x:String x:Key="Text.Hotkeys.Repo.StageOrUnstageSelected" xml:space="preserve">暫存或取消暫存選取的變更</x:String>
373377
<x:String x:Key="Text.Hotkeys.Repo.OpenSearchCommits" xml:space="preserve">切換左邊欄為歷史搜尋模式</x:String>

src/ViewModels/Histories.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using System.Text;
55

66
using Avalonia.Controls;
7-
using Avalonia.Input;
87
using Avalonia.Platform.Storage;
98

109
using CommunityToolkit.Mvvm.ComponentModel;
@@ -545,7 +544,6 @@ public ContextMenu MakeContextMenu(ListBox list)
545544
var createBranch = new MenuItem();
546545
createBranch.Icon = App.CreateMenuIcon("Icons.Branch.Add");
547546
createBranch.Header = App.Text("CreateBranch");
548-
createBranch.HotKey = new KeyGesture(Key.B, KeyModifiers.Control);
549547
createBranch.Click += (_, e) =>
550548
{
551549
if (PopupHost.CanCreatePopup())

src/Views/Histories.axaml.cs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
using Avalonia.Media;
1313
using Avalonia.Threading;
1414
using Avalonia.VisualTree;
15-
using SourceGit.ViewModels;
1615

1716
namespace SourceGit.Views
1817
{
@@ -723,11 +722,15 @@ private void OnCommitListDoubleTapped(object sender, TappedEventArgs e)
723722

724723
private void OnCommitListKeyDown(object sender, KeyEventArgs e)
725724
{
725+
bool isSystemCmdKeyDown = (OperatingSystem.IsMacOS() && e.KeyModifiers.HasFlag(KeyModifiers.Meta)) ||
726+
(!OperatingSystem.IsMacOS() && e.KeyModifiers.HasFlag(KeyModifiers.Control));
727+
if (!isSystemCmdKeyDown)
728+
return;
729+
726730
// These shortcuts are not mentioned in the Shortcut Reference window. Is this expected?
727-
if (sender is ListBox { SelectedItems: { Count: > 0 } selected } &&
728-
e.KeyModifiers.HasFlag(KeyModifiers.Control))
731+
if (sender is ListBox { SelectedItems: { Count: > 0 } selected })
729732
{
730-
// CTRL + C -> Copy selected commit SHA and subject.
733+
// CTRL/COMMAND + C -> Copy selected commit SHA and subject.
731734
if (e.Key == Key.C)
732735
{
733736
var builder = new StringBuilder();
@@ -742,17 +745,16 @@ private void OnCommitListKeyDown(object sender, KeyEventArgs e)
742745
return;
743746
}
744747

745-
// CTRL + B -> shows Create Branch pop-up at selected commit.
748+
// CTRL/COMMAND + B -> shows Create Branch pop-up at selected commit.
746749
if (e.Key == Key.B)
747750
{
748751
if (selected.Count == 1 &&
749752
selected[0] is Models.Commit commit &&
750753
DataContext is ViewModels.Histories histories &&
751-
PopupHost.CanCreatePopup())
754+
ViewModels.PopupHost.CanCreatePopup())
752755
{
753-
PopupHost.ShowPopup(new ViewModels.CreateBranch(histories.Repo, commit));
756+
ViewModels.PopupHost.ShowPopup(new ViewModels.CreateBranch(histories.Repo, commit));
754757
e.Handled = true;
755-
756758
}
757759
}
758760
}

src/Views/Hotkeys.axaml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
FontSize="{Binding Source={x:Static vm:Preference.Instance}, Path=DefaultFontSize, Converter={x:Static c:DoubleConverters.Increase}}"
7272
Margin="0,8"/>
7373

74-
<Grid RowDefinitions="20,20,20,20,20,20,20,20,20,20,20,20,20,20" ColumnDefinitions="150,*">
74+
<Grid RowDefinitions="20,20,20,20,20,20,20,20,20,20,20,20,20,20,20" ColumnDefinitions="150,*">
7575
<TextBlock Grid.Row="0" Grid.Column="0" Classes="primary bold" Text="{OnPlatform Ctrl+Shift+H, macOS=⌘+⇧+H}"/>
7676
<TextBlock Grid.Row="0" Grid.Column="1" Margin="16,0,0,0" Text="{DynamicResource Text.Hotkeys.Repo.GoHome}" />
7777

@@ -102,17 +102,20 @@
102102
<TextBlock Grid.Row="9" Grid.Column="0" Classes="primary bold" Text="{OnPlatform Alt+Enter, macOS=⌥+Enter}"/>
103103
<TextBlock Grid.Row="9" Grid.Column="1" Margin="16,0,0,0" Text="{DynamicResource Text.Hotkeys.Repo.CommitAndPush}" />
104104

105-
<TextBlock Grid.Row="10" Grid.Column="0" Classes="primary bold" Text="{OnPlatform Ctrl+Shift+Down, macOS=⌘+Shift+Down}"/>
106-
<TextBlock Grid.Row="10" Grid.Column="1" Margin="16,0,0,0" Text="{DynamicResource Text.Hotkeys.Repo.Pull}" />
105+
<TextBlock Grid.Row="10" Grid.Column="0" Classes="primary bold" Text="{OnPlatform Ctrl+Down, macOS=⌘+Down}"/>
106+
<TextBlock Grid.Row="10" Grid.Column="1" Margin="16,0,0,0" Text="{DynamicResource Text.Hotkeys.Repo.Fetch}" />
107107

108-
<TextBlock Grid.Row="11" Grid.Column="0" Classes="primary bold" Text="{OnPlatform Ctrl+Shift+Up, macOS=⌘+Shift+Up}"/>
109-
<TextBlock Grid.Row="11" Grid.Column="1" Margin="16,0,0,0" Text="{DynamicResource Text.Hotkeys.Repo.Push}" />
108+
<TextBlock Grid.Row="11" Grid.Column="0" Classes="primary bold" Text="{OnPlatform Ctrl+Shift+Down, macOS=⌘+⇧+Down}"/>
109+
<TextBlock Grid.Row="11" Grid.Column="1" Margin="16,0,0,0" Text="{DynamicResource Text.Hotkeys.Repo.Pull}" />
110110

111-
<TextBlock Grid.Row="12" Grid.Column="0" Classes="primary bold" Text="{OnPlatform Ctrl+B, macOS=⌘+B}"/>
112-
<TextBlock Grid.Row="12" Grid.Column="1" Margin="16,0,0,0" Text="{DynamicResource Text.Hotkeys.Repo.CreateBranchOnCommit}" />
111+
<TextBlock Grid.Row="12" Grid.Column="0" Classes="primary bold" Text="{OnPlatform Ctrl+Shift+Up, macOS=⌘+⇧+Up}"/>
112+
<TextBlock Grid.Row="12" Grid.Column="1" Margin="16,0,0,0" Text="{DynamicResource Text.Hotkeys.Repo.Push}" />
113113

114-
<TextBlock Grid.Row="13" Grid.Column="0" Classes="primary bold" Text="F5"/>
115-
<TextBlock Grid.Row="13" Grid.Column="1" Margin="16,0,0,0" Text="{DynamicResource Text.Hotkeys.Repo.Refresh}" />
114+
<TextBlock Grid.Row="13" Grid.Column="0" Classes="primary bold" Text="{OnPlatform Ctrl+B, macOS=⌘+B}"/>
115+
<TextBlock Grid.Row="13" Grid.Column="1" Margin="16,0,0,0" Text="{DynamicResource Text.Hotkeys.Repo.CreateBranchOnCommit}" />
116+
117+
<TextBlock Grid.Row="14" Grid.Column="0" Classes="primary bold" Text="F5"/>
118+
<TextBlock Grid.Row="14" Grid.Column="1" Margin="16,0,0,0" Text="{DynamicResource Text.Hotkeys.Repo.Refresh}" />
116119
</Grid>
117120

118121
<TextBlock Text="{DynamicResource Text.Hotkeys.TextEditor}"

src/Views/RepositoryToolbar.axaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
</StackPanel>
3232

3333
<StackPanel Grid.Column="1" Orientation="Horizontal">
34-
<Button Classes="icon_button" Width="32" Click="Fetch">
34+
<Button Classes="icon_button" Width="32" Click="Fetch" HotKey="{OnPlatform Ctrl+Down, macOS=⌘+Down}">
3535
<ToolTip.Tip>
3636
<StackPanel Orientation="Vertical">
3737
<TextBlock Text="{DynamicResource Text.Fetch}"/>
@@ -85,7 +85,6 @@
8585
Fill="{DynamicResource Brush.Border2}"/>
8686

8787
<Button Classes="icon_button" Width="32" Margin="16,0,0,0" Command="{Binding CreateNewBranch}" ToolTip.Tip="{DynamicResource Text.Repository.NewBranch}">
88-
8988
<Path Width="14" Height="14" Data="{StaticResource Icons.Branch.Add}"/>
9089
</Button>
9190

src/Views/RepositoryToolbar.axaml.cs

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
using System;
2+
13
using Avalonia.Controls;
24
using Avalonia.Input;
35
using Avalonia.Interactivity;
@@ -45,22 +47,43 @@ private async void OpenConfigure(object sender, RoutedEventArgs e)
4547
private void Fetch(object _, RoutedEventArgs e)
4648
{
4749
var launcher = this.FindAncestorOfType<Launcher>();
48-
(DataContext as ViewModels.Repository)?.Fetch(launcher?.HasKeyModifier(KeyModifiers.Control) ?? false);
49-
e.Handled = true;
50+
if (launcher is not null && DataContext is ViewModels.Repository repo)
51+
{
52+
var startDirectly = launcher.HasKeyModifier(KeyModifiers.Control);
53+
if (!startDirectly && OperatingSystem.IsMacOS())
54+
startDirectly = launcher.HasKeyModifier(KeyModifiers.Meta);
55+
56+
repo.Fetch(startDirectly);
57+
e.Handled = true;
58+
}
5059
}
5160

5261
private void Pull(object _, RoutedEventArgs e)
5362
{
5463
var launcher = this.FindAncestorOfType<Launcher>();
55-
(DataContext as ViewModels.Repository)?.Pull(launcher?.HasKeyModifier(KeyModifiers.Control) ?? false);
56-
e.Handled = true;
64+
if (launcher is not null && DataContext is ViewModels.Repository repo)
65+
{
66+
var startDirectly = launcher.HasKeyModifier(KeyModifiers.Control);
67+
if (!startDirectly && OperatingSystem.IsMacOS())
68+
startDirectly = launcher.HasKeyModifier(KeyModifiers.Meta);
69+
70+
repo.Pull(startDirectly);
71+
e.Handled = true;
72+
}
5773
}
5874

5975
private void Push(object _, RoutedEventArgs e)
6076
{
6177
var launcher = this.FindAncestorOfType<Launcher>();
62-
(DataContext as ViewModels.Repository)?.Push(launcher?.HasKeyModifier(KeyModifiers.Control) ?? false);
63-
e.Handled = true;
78+
if (launcher is not null && DataContext is ViewModels.Repository repo)
79+
{
80+
var startDirectly = launcher.HasKeyModifier(KeyModifiers.Control);
81+
if (!startDirectly && OperatingSystem.IsMacOS())
82+
startDirectly = launcher.HasKeyModifier(KeyModifiers.Meta);
83+
84+
repo.Push(startDirectly);
85+
e.Handled = true;
86+
}
6487
}
6588

6689
private void StashAll(object _, RoutedEventArgs e)

0 commit comments

Comments
 (0)