First, thank you to the creator for sharing this script. I noticed an odd behavior when using it. After Win + D is used to go to the desktop, I frequently use Alt + Tab to return to the previously selected window. With this script enabled, Alt + Tab sometimes selects the second most recent window instead of the usual first. This means that to return to the previous window after using the desktop shortcut you'd have to cycle through all of the open windows with Alt + Tab or use your mouse to click the first window.
This only happens when there is no input after using the desktop shortcut. For example, if I use the desktop shortcut, then click on the desktop, then press Alt + Tab to return to the window, it works as intended and defaults to the most recent window. If I use the shortcut to just show the desktop, not clicking anything, then try to Alt + Tab back, the issue happens and the second most recent window is defaulted.
If I'm guessing what the cause could be, and I very well could be wrong, I think the script may not track when the shortcut is used to select the desktop, so windows still thinks you are on the window you just minimized. When you press Alt + Tab afterwards, it thinks it is going from one window to the next one instead of from the desktop back. When you click the desktop, it becomes actively selected instead of the previous window and Alt + Tab functions as normal. The issue could be fixed with one line of code making the desktop the selected window after the shortcut is pressed and desktop is shown.
Here is a video demonstration.
You can see whenever I click on the desktop (red dot), it behaves as normal, but if I don't interact with the desktop at all, the issue occurs.
First, thank you to the creator for sharing this script. I noticed an odd behavior when using it. After Win + D is used to go to the desktop, I frequently use Alt + Tab to return to the previously selected window. With this script enabled, Alt + Tab sometimes selects the second most recent window instead of the usual first. This means that to return to the previous window after using the desktop shortcut you'd have to cycle through all of the open windows with Alt + Tab or use your mouse to click the first window.
This only happens when there is no input after using the desktop shortcut. For example, if I use the desktop shortcut, then click on the desktop, then press Alt + Tab to return to the window, it works as intended and defaults to the most recent window. If I use the shortcut to just show the desktop, not clicking anything, then try to Alt + Tab back, the issue happens and the second most recent window is defaulted.
If I'm guessing what the cause could be, and I very well could be wrong, I think the script may not track when the shortcut is used to select the desktop, so windows still thinks you are on the window you just minimized. When you press Alt + Tab afterwards, it thinks it is going from one window to the next one instead of from the desktop back. When you click the desktop, it becomes actively selected instead of the previous window and Alt + Tab functions as normal. The issue could be fixed with one line of code making the desktop the selected window after the shortcut is pressed and desktop is shown.
Here is a video demonstration.
You can see whenever I click on the desktop (red dot), it behaves as normal, but if I don't interact with the desktop at all, the issue occurs.