MScholtes / VirtualDesktop

C# command line tool to manage virtual desktops in Windows 10
MIT License
595 stars 59 forks source link

WinExist in another Virtual Desktop #80

Closed jdmarch closed 7 months ago

jdmarch commented 7 months ago

It would be great to have a hotkey which checks whether a specific app (window) is open in any Virtual Desktop, and if it is, activates it in its already-existing desktop. If it does not yet exist, I would open it in the current desktop, but YMMV. Thanks!

MScholtes commented 7 months ago

Hello @jdmarch,

not sure if you mean my repository. Virtualdesktop is a pure command line program that does not know hotkeys.

You can accomplish what you want with the following commands at a cmd.exe prompt (assuming the app you are searching is notepad):

virtualdesktop.exe /GetDesktopFromWindow:notepad
if %ERRORLEVEL% GEQ 0 ( virtualdesktop.exe /Switch:%ERRORLEVEL% ) else ( start notepad )

Greetings

Markus

jdmarch commented 7 months ago

My apologies, Markus. Indeed, not the repo I intended (that was https://github.com/FuPeiJiang/VD.ahk). But your response is on point nonetheless, thank you!

jdmarch commented 7 months ago

(I see what happened -- I clicked on the "create an issue" link in a comment of yours which had been pasted into the VD.ahk repo home page.)