Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cycling over all desktops while going to target one #80

Open
theartkod opened this issue Sep 23, 2022 · 3 comments
Open

Cycling over all desktops while going to target one #80

theartkod opened this issue Sep 23, 2022 · 3 comments

Comments

@theartkod
Copy link

When going from 1 desktop to 5 via shortcut, instead of toggling straight from 1 to 5, looks like appear cycling every desktop until we reach 5 (target desktop).

System: Windows 11 21H2

reproduce_issue.mp4
@Elijas
Copy link
Collaborator

Elijas commented Sep 23, 2022

Yes, this is the default implementation, as it works the most robustly across systems and is least likely to break long-term.

If I remember correctly, the other solution is to use the DLL (VirtualDesktopAccessor.dll) as it contains API to "jump" straight into the target desktop.

Ideally, we could select which implementation to use in a config - if anyone wanted to develop this, I'd be happy to review it and merge it

@theartkod
Copy link
Author

@Elijas Hi! Thanks for quick answer!

Can you suggest, please, how I can change to this dll just for myself?

@Elijas
Copy link
Collaborator

Elijas commented Sep 23, 2022

Yup!

High-level overview:

  1. This is the function that needs to be updated: _switchDesktopToTarget().
  2. Currently, it works just by sending the "switch to next desktop" keyboard shortcut until the target desktop is reached.
  3. To make it "jump", replace how it works currently with how it's done with the DLL call in this example in Ciantic/VirtualDesktopAccessor/README.

In more detail, the end result would look something similar to:

At the top of the desktop_switcher.ahk file:

GoToDesktopNumberProc := DllCall("GetProcAddress", Ptr, hVirtualDesktopAccessor, AStr, "GoToDesktopNumber", "Ptr")

In _switchDesktopToTarget function of the desktop_switcher.ahk file

DllCall(GoToDesktopNumberProc, Int, num)

There are other DllCall examples in both, the desktop_switcher.ahk file, and in the https://github.com/Ciantic/VirtualDesktopAccessor repo.

Let me know if you have any questions, and If you succeed I'd highly encourage you to release a pull request, just as a helpful example for others who would want to change to the DLL solution as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants