Closed untoreh closed 3 years ago
Sorry for the slow reply, been busy with other things.
pmb6tz's version uses a dll call on this line https://github.com/pmb6tz/windows-desktop-switcher/blob/master/desktop_switcher.ahk#L184 to check if the window is on the current desktop. The dll comes from Ciantic's VirtualDesktopAccessor repository and looks to be calling some private system calls (i.e. functions Window's doesn't want you to call directly as they might change them in a windows update e.g. https://github.com/Ciantic/VirtualDesktopAccessor/issues/33).
This repo is only using public API calls so that it doesn't break when window's updates (it's been stable for 5 years now). We could probably use this function https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-ivirtualdesktopmanager-iswindowoncurrentvirtualdesktop. I don't have the time to play around at the moment. I'll close this when I can find time to fix it
I now use a similar approach to the one you recommended. It should be a lot less glitchy now
When switching between virtual desktops a few gliches appear, I guess related to the fact that the script goes throught the task switcher window to switch desktop. The implementation here https://github.com/pmb6tz/windows-desktop-switcher uses a different approach where it just iterates over desktops, the amount of glitches is reduced to a few frames that can show the content of desktops in between the starting one and the target one. Maybe you can consider using that one instead?