Skip to content

Commit 68566b9

Browse files
committed
enhance: use instead of Ctrl , instead of Alt for all hotkeys used by this app on macOS (#103)
1 parent 9627206 commit 68566b9

File tree

5 files changed

+26
-19
lines changed

5 files changed

+26
-19
lines changed

src/Views/Hotkeys.axaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,13 @@
6868
Margin="0,0,0,8"/>
6969

7070
<Grid RowDefinitions="20,20,20,20" ColumnDefinitions="80,*">
71-
<TextBlock Grid.Row="0" Grid.Column="0" Classes="monospace bold" Text="Ctrl+T"/>
71+
<TextBlock Grid.Row="0" Grid.Column="0" Classes="monospace bold" Text="{OnPlatform Ctrl+T, macOS=⌘+T}"/>
7272
<TextBlock Grid.Row="0" Grid.Column="1" Margin="16,0,0,0" Text="{DynamicResource Text.Hotkeys.Global.NewTab}" />
7373

74-
<TextBlock Grid.Row="1" Grid.Column="0" Classes="monospace bold" Text="Ctrl+W" />
74+
<TextBlock Grid.Row="1" Grid.Column="0" Classes="monospace bold" Text="{OnPlatform Ctrl+W, macOS=⌘+W}" />
7575
<TextBlock Grid.Row="1" Grid.Column="1" Margin="16,0,0,0" Text="{DynamicResource Text.Hotkeys.Global.CloseTab}" />
7676

77-
<TextBlock Grid.Row="2" Grid.Column="0" Classes="monospace bold" Text="Ctrl+Tab"/>
77+
<TextBlock Grid.Row="2" Grid.Column="0" Classes="monospace bold" Text="{OnPlatform Ctrl+Tab, macOS=⌘+⌥+>}"/>
7878
<TextBlock Grid.Row="2" Grid.Column="1" Margin="16,0,0,0" Text="{DynamicResource Text.Hotkeys.Global.GotoNextTab}" />
7979

8080
<TextBlock Grid.Row="3" Grid.Column="0" Classes="monospace bold" Text="ESC"/>
@@ -88,19 +88,19 @@
8888
Margin="0,8"/>
8989

9090
<Grid RowDefinitions="20,20,20,20,20,20" ColumnDefinitions="80,*">
91-
<TextBlock Grid.Row="0" Grid.Column="0" Classes="monospace bold" Text="Ctrl+F"/>
91+
<TextBlock Grid.Row="0" Grid.Column="0" Classes="monospace bold" Text="{OnPlatform Ctrl+F, macOS=⌘+F}"/>
9292
<TextBlock Grid.Row="0" Grid.Column="1" Margin="16,0,0,0" Text="{DynamicResource Text.Hotkeys.Repo.ToggleSearch}" />
9393

94-
<TextBlock Grid.Row="1" Grid.Column="0" Classes="monospace bold" Text="Ctrl+1"/>
94+
<TextBlock Grid.Row="1" Grid.Column="0" Classes="monospace bold" Text="{OnPlatform Ctrl+1, macOS=⌘+1}"/>
9595
<TextBlock Grid.Row="1" Grid.Column="1" Margin="16,0,0,0" Text="{DynamicResource Text.Hotkeys.Repo.ViewHistories}" />
9696

97-
<TextBlock Grid.Row="2" Grid.Column="0" Classes="monospace bold" Text="Ctrl+2"/>
97+
<TextBlock Grid.Row="2" Grid.Column="0" Classes="monospace bold" Text="{OnPlatform Ctrl+2, macOS=⌘+2}"/>
9898
<TextBlock Grid.Row="2" Grid.Column="1" Margin="16,0,0,0" Text="{DynamicResource Text.Hotkeys.Repo.ViewChanges}" />
9999

100-
<TextBlock Grid.Row="3" Grid.Column="0" Classes="monospace bold" Text="Ctrl+3"/>
100+
<TextBlock Grid.Row="3" Grid.Column="0" Classes="monospace bold" Text="{OnPlatform Ctrl+3, macOS=⌘+3}"/>
101101
<TextBlock Grid.Row="3" Grid.Column="1" Margin="16,0,0,0" Text="{DynamicResource Text.Hotkeys.Repo.ViewStashes}" />
102102

103-
<TextBlock Grid.Row="4" Grid.Column="0" Classes="monospace bold" Text="SPACE"/>
103+
<TextBlock Grid.Row="4" Grid.Column="0" Classes="monospace bold" Text="Space"/>
104104
<TextBlock Grid.Row="4" Grid.Column="1" Margin="16,0,0,0" Text="{DynamicResource Text.Hotkeys.Repo.StageOrUnstageSelected}" />
105105

106106
<TextBlock Grid.Row="5" Grid.Column="0" Classes="monospace bold" Text="F5"/>
@@ -114,10 +114,10 @@
114114
Margin="0,8"/>
115115

116116
<Grid RowDefinitions="20,20,20,20" ColumnDefinitions="80,*">
117-
<TextBlock Grid.Row="0" Grid.Column="0" Classes="monospace bold" Text="Ctrl+F"/>
117+
<TextBlock Grid.Row="0" Grid.Column="0" Classes="monospace bold" Text="{OnPlatform Ctrl+F, macOS=⌘+F}"/>
118118
<TextBlock Grid.Row="0" Grid.Column="1" Margin="16,0,0,0" Text="{DynamicResource Text.Hotkeys.TextEditor.Search}" />
119119

120-
<TextBlock Grid.Row="1" Grid.Column="0" Classes="monospace bold" Text="Shift+F3"/>
120+
<TextBlock Grid.Row="1" Grid.Column="0" Classes="monospace bold" Text="{OnPlatform Shift+F3, macOS=⇧+F3}"/>
121121
<TextBlock Grid.Row="1" Grid.Column="1" Margin="16,0,0,0" Text="{DynamicResource Text.Hotkeys.TextEditor.GotoPrevMatch}" />
122122

123123
<TextBlock Grid.Row="2" Grid.Column="0" Classes="monospace bold" Text="F3"/>

src/Views/Launcher.axaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@
203203
<ToolTip.Tip>
204204
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
205205
<TextBlock Text="{DynamicResource Text.PageTabBar.Tab.Close}" VerticalAlignment="Center"/>
206-
<TextBlock Margin="16,0,0,0" Text="Ctrl+W" Opacity=".6" FontSize="11" VerticalAlignment="Center"/>
206+
<TextBlock Margin="16,0,0,0" Text="{OnPlatform Ctrl+W, macOS=⌘+W}" Opacity=".6" FontSize="11" VerticalAlignment="Center"/>
207207
</StackPanel>
208208
</ToolTip.Tip>
209209
<Path Width="8" Height="8" Data="{StaticResource Icons.Window.Close}"/>
@@ -226,12 +226,11 @@
226226
<Button Classes="icon_button"
227227
Width="16" Height="16"
228228
Margin="8,0"
229-
Command="{Binding AddNewTab}"
230-
HotKey="Ctrl+T">
229+
Command="{Binding AddNewTab}">
231230
<ToolTip.Tip>
232231
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
233232
<TextBlock Text="{DynamicResource Text.PageTabBar.New}" VerticalAlignment="Center"/>
234-
<TextBlock Margin="16,0,0,0" Text="Ctrl+T" Opacity=".6" FontSize="11" VerticalAlignment="Center"/>
233+
<TextBlock Margin="16,0,0,0" Text="{OnPlatform Ctrl+T, macOS=⌘+T}" Opacity=".6" FontSize="11" VerticalAlignment="Center"/>
235234
</StackPanel>
236235
</ToolTip.Tip>
237236

src/Views/Launcher.axaml.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,23 @@ public void OnReceiveNotification(string ctx, Models.Notification notice)
9898
protected override void OnKeyDown(KeyEventArgs e)
9999
{
100100
var vm = DataContext as ViewModels.Launcher;
101-
if (e.KeyModifiers.HasFlag(KeyModifiers.Control))
101+
if ((OperatingSystem.IsMacOS() && e.KeyModifiers.HasFlag(KeyModifiers.Meta)) ||
102+
(!OperatingSystem.IsMacOS() && e.KeyModifiers.HasFlag(KeyModifiers.Control)))
102103
{
103104
if (e.Key == Key.W)
104105
{
105106
vm.CloseTab(null);
106107
e.Handled = true;
107108
return;
108109
}
109-
else if (e.Key == Key.Tab)
110+
else if (e.Key == Key.T)
111+
{
112+
vm.AddNewTab();
113+
e.Handled = true;
114+
return;
115+
}
116+
else if ((OperatingSystem.IsMacOS() && e.KeyModifiers.HasFlag(KeyModifiers.Alt) && e.Key == Key.Right) ||
117+
(!OperatingSystem.IsMacOS() && e.Key == Key.Tab))
110118
{
111119
vm.GotoNextTab();
112120
e.Handled = true;

src/Views/Repository.axaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<ToolTip.Tip>
3333
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
3434
<TextBlock Text="{DynamicResource Text.Repository.Search}" VerticalAlignment="Center"/>
35-
<TextBlock Margin="16,0,0,0" Text="Ctrl+F" Opacity=".6" FontSize="11" VerticalAlignment="Center"/>
35+
<TextBlock Margin="16,0,0,0" Text="{OnPlatform Ctrl+F, macOS=⌘+F}" Opacity=".6" FontSize="11" VerticalAlignment="Center"/>
3636
</StackPanel>
3737
</ToolTip.Tip>
3838
<Path Width="14" Height="14" Data="{StaticResource Icons.Search}"/>

src/Views/WorkingCopy.axaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
<ToolTip.Tip>
4848
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
4949
<TextBlock Text="{DynamicResource Text.WorkingCopy.Unstaged.Stage}" VerticalAlignment="Center"/>
50-
<TextBlock Margin="16,0,0,0" Text="SPACE" Opacity=".6" FontSize="11" VerticalAlignment="Center"/>
50+
<TextBlock Margin="16,0,0,0" Text="Space" Opacity=".6" FontSize="11" VerticalAlignment="Center"/>
5151
</StackPanel>
5252
</ToolTip.Tip>
5353
<Path Width="14" Height="14" Margin="0,6,0,0" Data="{StaticResource Icons.Down}"/>
@@ -183,7 +183,7 @@
183183
<ToolTip.Tip>
184184
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
185185
<TextBlock Text="{DynamicResource Text.WorkingCopy.Staged.Unstage}" VerticalAlignment="Center"/>
186-
<TextBlock Margin="16,0,0,0" Text="SPACE" Opacity=".6" FontSize="11" VerticalAlignment="Center"/>
186+
<TextBlock Margin="16,0,0,0" Text="Space" Opacity=".6" FontSize="11" VerticalAlignment="Center"/>
187187
</StackPanel>
188188
</ToolTip.Tip>
189189
<Path Width="14" Height="14" Margin="0,6,0,0" Data="{StaticResource Icons.Up}"/>

0 commit comments

Comments
 (0)