MScholtes / VirtualDesktop

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

suggestion #73

Closed jonathan-annett closed 1 year ago

jonathan-annett commented 1 year ago

line 840 aprox in virtualDesktop.cs

                            case "WAITDESKTOPCHANGE":
                            case "WDC":
                            case "GETCURRENTDESKTOP": // get number of current desktop and display desktop name
                            case "GCD":
                                rc = VirtualDesktop.Desktop.FromDesktop(VirtualDesktop.Desktop.Current);
                                switch(groups[1].Value.ToUpper()) {
                                    case "WAITDESKTOPCHANGE":
                                    case "WDC":
                                    System.Threading.Thread.Sleep(5);
                                    if (verbose) Console.WriteLine("Waiting for desktop to change from: '" + VirtualDesktop.Desktop.DesktopNameFromDesktop(VirtualDesktop.Desktop.Current) + "' (desktop number " + rc + ")");
                                    while (rc == VirtualDesktop.Desktop.FromDesktop(VirtualDesktop.Desktop.Current)) {
                                        System.Threading.Thread.Sleep(5);
                                    }
                                    break;                      
                                }
                                if (verbose) Console.WriteLine("Current desktop: '" + VirtualDesktop.Desktop.DesktopNameFromDesktop(VirtualDesktop.Desktop.Current) + "' (desktop number " + rc + ")");
                                break;

adds an option to wait until the user changes to another desktop eg switch to desktop 2, then as soon as they move elsewhere yank them back to 0

 .\VirtualDesktop.exe /switch:2  /WDC  /switch:0

if you prefer i can make a PR, however it's such a trivial change, you may prefer to just implement it yourself

MScholtes commented 1 year ago

Hello @jonathan-annett,

thank you for your suggestion.

But to be honest, I don't see the point in building a function that waits for a user to switch desktops. Virtualdesktop is a tool to change desktops, not to wait for this.

Additionally I have the concept of making a One Shot Tool.

Greetings

Markus

jonathan-annett commented 1 year ago

All good. I've forked and moved on. Good luck with your project

On Wed, 25 Oct 2023, 4:30 am MScholtes, @.***> wrote:

Hello @jonathan-annett https://github.com/jonathan-annett,

thank you for your suggestion.

But to be honest, I don't see the point in building a function that waits for a user to switch desktops. Virtualdesktop is a tool to change desktops, not to wait for this.

Additionally I have the concept of making a One Shot Tool.

Greetings

Markus

— Reply to this email directly, view it on GitHub https://github.com/MScholtes/VirtualDesktop/issues/73#issuecomment-1777703328, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADGSBMGML3UAVRUERC35D2LYA73LFAVCNFSM6AAAAAA6KRRJJSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONZXG4YDGMZSHA . You are receiving this because you were mentioned.Message ID: @.***>