Implement wrap around for the damn 0 (should be 123..90 not 0123..9)
This commit is contained in:
@@ -136,6 +136,9 @@ internal static class Program {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void Swap(int index) {
|
private static void Swap(int index) {
|
||||||
|
index = (index - 1) % NumProc;
|
||||||
|
if (index < 0) index = NumProc - 1;
|
||||||
|
if (index >= NumProc) return;
|
||||||
Console.WriteLine($"Swapping window at index {index}");
|
Console.WriteLine($"Swapping window at index {index}");
|
||||||
var process = GetForegroundProcess();
|
var process = GetForegroundProcess();
|
||||||
if (process == null) return;
|
if (process == null) return;
|
||||||
@@ -172,6 +175,8 @@ internal static class Program {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void TabTo(int index) {
|
private static void TabTo(int index) {
|
||||||
|
index = (index - 1) % NumProc;
|
||||||
|
if (index < 0) index = NumProc - 1;
|
||||||
if (index >= NumProc) return;
|
if (index >= NumProc) return;
|
||||||
Console.WriteLine($"Tab to window at index {index}");
|
Console.WriteLine($"Tab to window at index {index}");
|
||||||
|
|
||||||
@@ -203,8 +208,8 @@ internal static class Program {
|
|||||||
|
|
||||||
for (int i = 0; i < NumProc; i++) {
|
for (int i = 0; i < NumProc; i++) {
|
||||||
windows[i] = null;
|
windows[i] = null;
|
||||||
HotKeyManager.RegisterHotKey(Keys.D1 + i, KeyModifiers.Alt);
|
HotKeyManager.RegisterHotKey(Keys.D0 + i, KeyModifiers.Alt);
|
||||||
HotKeyManager.RegisterHotKey(Keys.D1 + i, KeyModifiers.Alt | KeyModifiers.Shift);
|
HotKeyManager.RegisterHotKey(Keys.D0 + i, KeyModifiers.Alt | KeyModifiers.Shift);
|
||||||
}
|
}
|
||||||
|
|
||||||
HotKeyManager.RegisterHotKey(Keys.Oemtilde, KeyModifiers.Alt);
|
HotKeyManager.RegisterHotKey(Keys.Oemtilde, KeyModifiers.Alt);
|
||||||
@@ -217,10 +222,10 @@ internal static class Program {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (e.Modifiers == KeyModifiers.Alt) {
|
if (e.Modifiers == KeyModifiers.Alt) {
|
||||||
TabTo(e.Key - Keys.D1);
|
TabTo(e.Key - Keys.D0);
|
||||||
}
|
}
|
||||||
else if (e.Modifiers == (KeyModifiers.Alt | KeyModifiers.Shift)) {
|
else if (e.Modifiers == (KeyModifiers.Alt | KeyModifiers.Shift)) {
|
||||||
Swap(e.Key - Keys.D1);
|
Swap(e.Key - Keys.D0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user