|
33 | 33 | using Windows.UI.Xaml.Media;
|
34 | 34 | using Windows.UI.Xaml.Media.Animation;
|
35 | 35 | using Windows.UI.Xaml.Navigation;
|
36 |
| - |
| 36 | +using Files.Interacts; |
37 | 37 | using SortDirection = Files.Enums.SortDirection;
|
38 | 38 |
|
39 | 39 | // The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
|
@@ -190,6 +190,32 @@ public ColumnShellPage()
|
190 | 190 | SystemNavigationManager.GetForCurrentView().BackRequested += ColumnShellPage_BackRequested;
|
191 | 191 |
|
192 | 192 | App.DrivesManager.PropertyChanged += DrivesManager_PropertyChanged;
|
| 193 | + |
| 194 | + PreviewKeyDown += ColumnShellPage_PreviewKeyDown; |
| 195 | + } |
| 196 | + |
| 197 | + private async void ColumnShellPage_PreviewKeyDown(object sender, KeyRoutedEventArgs e) |
| 198 | + { |
| 199 | + var ctrlPressed = Window.Current.CoreWindow.GetKeyState(VirtualKey.Control).HasFlag(CoreVirtualKeyStates.Down); |
| 200 | + var tabInstance = CurrentPageType == typeof(DetailsLayoutBrowser) || CurrentPageType == typeof(GridViewBrowser); |
| 201 | + |
| 202 | + if (tabInstance && e.Key == (VirtualKey)192 && ctrlPressed) // VirtualKey for ` (accent key) |
| 203 | + { |
| 204 | + string path; |
| 205 | + // Check if there is a folder selected, if not use the current directory. |
| 206 | + if (SlimContentPage?.SelectedItem is not null && |
| 207 | + SlimContentPage?.SelectedItem.PrimaryItemAttribute == StorageItemTypes.Folder) |
| 208 | + { |
| 209 | + path = SlimContentPage.SelectedItem.ItemPath; |
| 210 | + } |
| 211 | + else |
| 212 | + { |
| 213 | + path = FilesystemViewModel.WorkingDirectory; |
| 214 | + } |
| 215 | + |
| 216 | + await NavigationHelpers.OpenDirectoryInTerminal(path); |
| 217 | + e.Handled = true; |
| 218 | + } |
193 | 219 | }
|
194 | 220 |
|
195 | 221 | private async void ColumnShellPage_ToolbarPathItemLoaded(object sender, ToolbarPathItemLoadedEventArgs e)
|
@@ -848,6 +874,7 @@ private void SelectSidebarItemFromPath(Type incomingSourcePageType = null)
|
848 | 874 |
|
849 | 875 | public void Dispose()
|
850 | 876 | {
|
| 877 | + PreviewKeyDown -= ColumnShellPage_PreviewKeyDown; |
851 | 878 | Window.Current.CoreWindow.PointerPressed -= CoreWindow_PointerPressed;
|
852 | 879 | SystemNavigationManager.GetForCurrentView().BackRequested -= ColumnShellPage_BackRequested;
|
853 | 880 | App.DrivesManager.PropertyChanged -= DrivesManager_PropertyChanged;
|
|
0 commit comments