Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
<MenuFlyoutItem
x:Uid="HorizontalMultitaskingControlDuplicateTab"
Click="{x:Bind vm:MainPageViewModel.DuplicateTabAtIndex}"
KeyboardAcceleratorTextOverride="Ctrl+Shift+K"
Text="Duplicate tab">
<MenuFlyoutItem.Icon>
<FontIcon FontFamily="{StaticResource CustomGlyph}" Glyph="&#xF11B;" />
Expand Down
18 changes: 9 additions & 9 deletions src/Files/ViewModels/MainPageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,16 @@ public TabItem SelectedTabItem

public ICommand AddNewInstanceAcceleratorCommand { get; private set; }

public ICommand ReopenClosedTabAcceleratorCommand { get; private set; }

public MainPageViewModel()
{
// Create commands
NavigateToNumberedTabKeyboardAcceleratorCommand = new RelayCommand<KeyboardAcceleratorInvokedEventArgs>(NavigateToNumberedTabKeyboardAccelerator);
OpenNewWindowAcceleratorCommand = new RelayCommand<KeyboardAcceleratorInvokedEventArgs>(OpenNewWindowAccelerator);
CloseSelectedTabKeyboardAcceleratorCommand = new RelayCommand<KeyboardAcceleratorInvokedEventArgs>(CloseSelectedTabKeyboardAccelerator);
AddNewInstanceAcceleratorCommand = new RelayCommand<KeyboardAcceleratorInvokedEventArgs>(AddNewInstanceAccelerator);
ReopenClosedTabAcceleratorCommand = new RelayCommand<KeyboardAcceleratorInvokedEventArgs>(ReopenClosedTabAccelerator);
}

private void NavigateToNumberedTabKeyboardAccelerator(KeyboardAcceleratorInvokedEventArgs e)
Expand Down Expand Up @@ -162,16 +165,13 @@ private void CloseSelectedTabKeyboardAccelerator(KeyboardAcceleratorInvokedEvent

private async void AddNewInstanceAccelerator(KeyboardAcceleratorInvokedEventArgs e)
{
bool shift = e.KeyboardAccelerator.Modifiers.HasFlag(VirtualKeyModifiers.Shift);
await AddNewTabAsync();
e.Handled = true;
}

if (!shift)
{
await AddNewTabAsync();
}
else // ctrl + shift + t, restore recently closed tab
{
((BaseMultitaskingControl)MultitaskingControl).ReopenClosedTab(null, null);
}
private void ReopenClosedTabAccelerator(KeyboardAcceleratorInvokedEventArgs e)
{
((BaseMultitaskingControl)MultitaskingControl).ReopenClosedTab(null, null);
e.Handled = true;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Files/Views/ColumnShellPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
Key="K"
Invoked="KeyboardAccelerator_Invoked"
IsEnabled="{x:Bind IsCurrentInstance, Mode=OneWay}"
Modifiers="Control" />
Modifiers="Control,Shift" />
</Page.KeyboardAccelerators>
<Grid
x:Name="RootGrid"
Expand Down
2 changes: 1 addition & 1 deletion src/Files/Views/ColumnShellPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ private async void KeyboardAccelerator_Invoked(KeyboardAccelerator sender, Keybo
UserSettingsService.PreferencesSettingsService.AreHiddenItemsVisible = !UserSettingsService.PreferencesSettingsService.AreHiddenItemsVisible;
break;

case (true, false, false, true, VirtualKey.K): // ctrl + k, duplicate tab
case (true, true, false, true, VirtualKey.K): // ctrl + shift + k, duplicate tab
await NavigationHelpers.OpenPathInNewTab(this.FilesystemViewModel.WorkingDirectory);
break;

Expand Down
4 changes: 2 additions & 2 deletions src/Files/Views/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,11 @@
<KeyboardAccelerator Key="T" Modifiers="Control,Shift">
<i:Interaction.Behaviors>
<icore:EventTriggerBehavior EventName="Invoked">
<icore:InvokeCommandAction Command="{x:Bind ViewModel.AddNewInstanceAcceleratorCommand}" />
<icore:InvokeCommandAction Command="{x:Bind ViewModel.ReopenClosedTabAcceleratorCommand}" />
</icore:EventTriggerBehavior>
</i:Interaction.Behaviors>
</KeyboardAccelerator>
<KeyboardAccelerator Key="K" Modifiers="Control">
<KeyboardAccelerator Key="K" Modifiers="Control,Shift">
<i:Interaction.Behaviors>
<icore:EventTriggerBehavior EventName="Invoked">
<icore:InvokeCommandAction Command="{x:Bind ViewModel.AddNewInstanceAcceleratorCommand}" />
Expand Down
2 changes: 1 addition & 1 deletion src/Files/Views/ModernShellPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
Key="K"
Invoked="KeyboardAccelerator_Invoked"
IsEnabled="{x:Bind IsCurrentInstance, Mode=OneWay}"
Modifiers="Control" />
Modifiers="Control,Shift" />
<KeyboardAccelerator
Key="F2"
Invoked="KeyboardAccelerator_Invoked"
Expand Down
2 changes: 1 addition & 1 deletion src/Files/Views/ModernShellPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ private async void KeyboardAccelerator_Invoked(KeyboardAccelerator sender, Keybo
UserSettingsService.PreferencesSettingsService.AreHiddenItemsVisible = !UserSettingsService.PreferencesSettingsService.AreHiddenItemsVisible;
break;

case (true, false, false, true, VirtualKey.K): // ctrl + k, duplicate tab
case (true, true, false, true, VirtualKey.K): // ctrl + shift + k, duplicate tab
await NavigationHelpers.OpenPathInNewTab(this.FilesystemViewModel.WorkingDirectory);
break;

Expand Down