Skip to content

Commit

Permalink
Remove ALT+CAPS to disable Switchy; Don't show popup by default
Browse files Browse the repository at this point in the history
  • Loading branch information
1280px authored Oct 2, 2022
1 parent e0b2956 commit 61d6f36
Showing 1 changed file with 5 additions and 25 deletions.
30 changes: 5 additions & 25 deletions Switchy/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ LRESULT CALLBACK LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam);


HHOOK hHook;
BOOL enabled = TRUE;
BOOL keystrokeCapsProcessed = FALSE;
BOOL keystrokeShiftProcessed = FALSE;
BOOL winPressed = FALSE;
Expand All @@ -30,15 +29,15 @@ Settings settings = {

int main(int argc, char** argv)
{
if (argc > 1 && strcmp(argv[1], "nopopup") == 0)
if (argc > 1 && strcmp(argv[1], "showpopup") != 0)
{
settings.popup = FALSE;
settings.popup = GetOSVersion() >= 10;
}
else
{
settings.popup = GetOSVersion() >= 10;
//settings.popup = FALSE;
settings.popup = FALSE;
}

#if _DEBUG
printf("Pop-up is %s\n", settings.popup ? "enabled" : "disabled");
#endif
Expand Down Expand Up @@ -129,15 +128,6 @@ LRESULT CALLBACK LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
#endif // _DEBUG
if (key->vkCode == VK_CAPITAL)
{
if (wParam == WM_SYSKEYDOWN && !keystrokeCapsProcessed)
{
keystrokeCapsProcessed = TRUE;
enabled = !enabled;
#if _DEBUG
printf("Switchy has been %s\n", enabled ? "enabled" : "disabled");
#endif // _DEBUG
return 1;
}

if (wParam == WM_KEYUP || wParam == WM_SYSKEYUP)
{
Expand All @@ -149,7 +139,7 @@ LRESULT CALLBACK LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
ReleaseKey(VK_LWIN);
}

if (enabled && !settings.popup)
if (!settings.popup)
{
if (!keystrokeShiftProcessed) {
PressKey(VK_MENU);
Expand All @@ -164,11 +154,6 @@ LRESULT CALLBACK LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
}
}

if (!enabled)
{
return CallNextHookEx(hHook, nCode, wParam, lParam);
}

if (wParam == WM_KEYDOWN && !keystrokeCapsProcessed)
{
keystrokeCapsProcessed = TRUE;
Expand Down Expand Up @@ -200,11 +185,6 @@ LRESULT CALLBACK LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
keystrokeShiftProcessed = FALSE;
}

if (!enabled)
{
return CallNextHookEx(hHook, nCode, wParam, lParam);
}

if (wParam == WM_KEYDOWN && !keystrokeShiftProcessed)
{
keystrokeShiftProcessed = TRUE;
Expand Down

0 comments on commit 61d6f36

Please sign in to comment.