mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-23 05:05:00 +00:00
feature<Launcher>: add common hotkeys
1. `Ctrl + Tab` goto next page 2. `Ctrl + W` close current active page 3. `Ctrl + T` open new page 4. `Ctrl + F` open search bar if possible 5. `Ctrl + [0-9]` go to page at given index if possible 6. `F5` refresh current repository if possible
This commit is contained in:
parent
c3b1b6d502
commit
7c98ed4990
5 changed files with 73 additions and 3 deletions
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace SourceGit.Views {
|
||||
|
||||
|
@ -94,5 +95,54 @@ namespace SourceGit.Views {
|
|||
GC.Collect();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region HOTKEYS
|
||||
protected override void OnPreviewKeyDown(KeyEventArgs e) {
|
||||
if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl)) {
|
||||
if (Keyboard.IsKeyDown(Key.Tab)) {
|
||||
tabs.Next();
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (Keyboard.IsKeyDown(Key.W)) {
|
||||
tabs.CloseCurrent();
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (Keyboard.IsKeyDown(Key.T)) {
|
||||
OnTabAdding(null, null);
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (Keyboard.IsKeyDown(Key.F)) {
|
||||
var dashboard = container.Get(tabs.Current) as Widgets.Dashboard;
|
||||
if (dashboard != null) {
|
||||
dashboard.OpenSearch(null, null);
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
if (Keyboard.IsKeyDown(Key.D1 + i)) {
|
||||
if (tabs.Tabs.Count > i) {
|
||||
tabs.Goto(tabs.Tabs[i].Id);
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Keyboard.IsKeyDown(Key.F5)) {
|
||||
Models.Watcher.Get(tabs.Current)?.Refresh();
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue