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

Support for wrapping/cycling through virtual desktops when moving windows with hotkeys #1

Open
laklare opened this issue Mar 8, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@laklare
Copy link

laklare commented Mar 8, 2023

VD.ahk has functions for relative desktop positions so I modified your code slightly to support wrapping left or right when moving windows between desktops using these hotkeys.

^#+Left::
    r := -1
    n := VD.getCurrentDesktopNum()
    m := VD.getRelativeDesktopNum(n, r)
    n = n+r
    active := "ahk_id" WinExist("A")
    VD.MoveWindowToDesktopNum(active,m), VD.goToRelativeDesktopNum(r)
    WinActivate active ;once in a while it's not active
Return

^#+Right::
    r := 1
    n := VD.getCurrentDesktopNum()
    m := VD.getRelativeDesktopNum(n, r)
    n = n+r
    active := "ahk_id" WinExist("A")
    VD.MoveWindowToDesktopNum(active,m), VD.goToRelativeDesktopNum(r)
    WinActivate active ;once in a while it's not active
Return

; wrapping / cycle back to first desktop when at the last
^#left::VD.goToRelativeDesktopNum(-1)
^#right::VD.goToRelativeDesktopNum(+1)
@phazei phazei added the enhancement New feature or request label Dec 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants