diff --git a/VirtualDesktopAccessor.dll b/VirtualDesktopAccessor.dll index d6af0ad..4f15a78 100644 Binary files a/VirtualDesktopAccessor.dll and b/VirtualDesktopAccessor.dll differ diff --git a/desktop_switcher.ahk b/desktop_switcher.ahk index 1935978..7761ac8 100644 --- a/desktop_switcher.ahk +++ b/desktop_switcher.ahk @@ -13,6 +13,7 @@ LastOpenedDesktop := 1 hVirtualDesktopAccessor := DllCall("LoadLibrary", "Str", A_ScriptDir . "\VirtualDesktopAccessor.dll", "Ptr") global IsWindowOnDesktopNumberProc := DllCall("GetProcAddress", Ptr, hVirtualDesktopAccessor, AStr, "IsWindowOnDesktopNumber", "Ptr") global MoveWindowToDesktopNumberProc := DllCall("GetProcAddress", Ptr, hVirtualDesktopAccessor, AStr, "MoveWindowToDesktopNumber", "Ptr") +global GoToDesktopNumberProc := DllCall("GetProcAddress", Ptr, hVirtualDesktopAccessor, AStr, "GoToDesktopNumber", "Ptr") ; Main SetKeyDelay, 75 @@ -112,19 +113,7 @@ _switchDesktopToTarget(targetDesktop) ; Fixes the issue of active windows in intermediate desktops capturing the switch shortcut and therefore delaying or stopping the switching sequence. This also fixes the flashing window button after switching in the taskbar. More info: https://github.com/pmb6tz/windows-desktop-switcher/pull/19 WinActivate, ahk_class Shell_TrayWnd - ; Go right until we reach the desktop we want - while(CurrentDesktop < targetDesktop) { - Send {LWin down}{LCtrl down}{Right down}{LWin up}{LCtrl up}{Right up} - CurrentDesktop++ - OutputDebug, [right] target: %targetDesktop% current: %CurrentDesktop% - } - - ; Go left until we reach the desktop we want - while(CurrentDesktop > targetDesktop) { - Send {LWin down}{LCtrl down}{Left down}{Lwin up}{LCtrl up}{Left up} - CurrentDesktop-- - OutputDebug, [left] target: %targetDesktop% current: %CurrentDesktop% - } + DllCall(GoToDesktopNumberProc, Int, targetDesktop-1) ; Makes the WinActivate fix less intrusive Sleep, 50