Win11AutoHotKeyFixes icon indicating copy to clipboard operation
Win11AutoHotKeyFixes copied to clipboard

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

Open laklare opened this issue 2 years ago • 0 comments

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)

laklare avatar Mar 08 '23 14:03 laklare