AHK-Virtual-Desktop-Library icon indicating copy to clipboard operation
AHK-Virtual-Desktop-Library copied to clipboard

Request: "Move windows to next/previous desktop"

Open riotrah opened this issue 3 years ago • 1 comments

Great work here firstly - appreciate your sharing it.

The "move window to desktop number <X>" is awesome, but I wonder if it would be possible to add "move to next/previous vd". This would match the "move to next/previous monitor" hotkeys already present natively in Windows ( and would help me switch between mac/win everyday as I have to for work! )

Thanks again.

Any tips on how I may implement this myself without needing to add another function on your part would also be appreciated!!

riotrah avatar Dec 25 '21 06:12 riotrah

Hi!

Put your best to understand it, and then feel free to ask me anything you don't get Btw I stopped coding and now im returning(sorry for the late response), so i'm pretty sure there's something wrong with the grammar, I forgot stuff So this is how I would do:

MoveCurrentWindowToNextDesktop(){
  currentDesktop := GetCurrentDesktop()
  nextDesktop := currentDesktop + 1
  amountOfDesktops := GetAmountOfDesktops()
  if nextDesktop =< amountOfDesktops
    MoveCurrentWindowToDesktop(nextDesktop)
  else
    msgbox, theres not a next desktop
}

MoveCurrentWindowToPrevDesktop(){
  currentDesktop := GetCurrentDesktop()
  prevDesktop := currentDesktop - 1
  if prevDesktop <= 1
    msgbox, theres not a previous desktop
  else
    MoveCurrentWindowToDesktop(prevDesktop)
}

If you make it work, share your code here so everyone can see it(including me because i'm curious)

adrian88888888 avatar Feb 13 '22 22:02 adrian88888888