Base logic off of scroll lock toggle instead of whatever the fuck we had previously
This commit is contained in:
@@ -19,6 +19,9 @@ internal static class Program {
|
|||||||
[DllImport("user32.dll")]
|
[DllImport("user32.dll")]
|
||||||
public static extern bool SetForegroundWindow(IntPtr hWnd);
|
public static extern bool SetForegroundWindow(IntPtr hWnd);
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
private static extern short GetKeyState(int nVirtKey);
|
||||||
|
|
||||||
[DllImport("kernel32.dll", SetLastError = true)]
|
[DllImport("kernel32.dll", SetLastError = true)]
|
||||||
[return:MarshalAs(UnmanagedType.Bool)]
|
[return:MarshalAs(UnmanagedType.Bool)]
|
||||||
static extern bool AllocConsole();
|
static extern bool AllocConsole();
|
||||||
@@ -202,6 +205,10 @@ internal static class Program {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static bool IsScrollLockOn() {
|
||||||
|
return (GetKeyState(0x91) & 1) == 1;
|
||||||
|
}
|
||||||
|
|
||||||
[STAThread]
|
[STAThread]
|
||||||
private static void Main() {
|
private static void Main() {
|
||||||
// AllocConsole();
|
// AllocConsole();
|
||||||
@@ -216,7 +223,6 @@ internal static class Program {
|
|||||||
Process.GetCurrentProcess().Kill();
|
Process.GetCurrentProcess().Kill();
|
||||||
}
|
}
|
||||||
|
|
||||||
long delLast = 0;
|
|
||||||
HotKeyManager.RegisterHotKey(Keys.Scroll, KeyModifiers.NoRepeat);
|
HotKeyManager.RegisterHotKey(Keys.Scroll, KeyModifiers.NoRepeat);
|
||||||
// Register main number keys (0-9)
|
// Register main number keys (0-9)
|
||||||
for (int i = 0; i < 10; i++)
|
for (int i = 0; i < 10; i++)
|
||||||
@@ -235,10 +241,6 @@ internal static class Program {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
long now = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
|
|
||||||
if (e.Key == Keys.Scroll)
|
|
||||||
delLast = now;
|
|
||||||
|
|
||||||
int index;
|
int index;
|
||||||
if (e.Key >= Keys.D0 && e.Key <= Keys.D9) {
|
if (e.Key >= Keys.D0 && e.Key <= Keys.D9) {
|
||||||
index = e.Key - Keys.D0;
|
index = e.Key - Keys.D0;
|
||||||
@@ -248,12 +250,9 @@ internal static class Program {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
long cocksucker = DateTime.Now.Second;
|
|
||||||
Console.WriteLine(cocksucker);
|
|
||||||
if (e.Modifiers == KeyModifiers.Alt) {
|
if (e.Modifiers == KeyModifiers.Alt) {
|
||||||
if (now - delLast <= 1) {
|
if (IsScrollLockOn()) {
|
||||||
Swap(index);
|
Swap(index);
|
||||||
delLast = 0;
|
|
||||||
} else {
|
} else {
|
||||||
TabTo(index);
|
TabTo(index);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user