widavies / WinJump

Jump to Nth virtual desktop shortcut for Windows
The Unlicense
78 stars 5 forks source link

Issues returning focus to last window #27

Open PhilipNelson5 opened 1 year ago

PhilipNelson5 commented 1 year ago

When changing desktops, the focused window remains on the last focused window on the desktop I just left. I'd expect it to change focus to the last window that had focus before I left the desktop to which I'm returning. Basically, every virtual desktop has a "focused window" which regains focus when that desktop is the active desktop. I've been using 1.4.0 for a while and just upgraded to 2.0.7 but I still see this issue. I see there is a focus-fixes branch, is this issue something you are already tracking?

widavies commented 1 year ago

@PhilipNelson5 Yeah, we've had this issue crop up before: https://github.com/widavies/WinJump/issues/21

It seems to be quite variable - sometimes it works, sometimes it doesn't. When I have some time I'll experiment with a few methods. It seems to be dependent on the Windows version, some handle the focus shift better than others.

widavies commented 1 year ago

What Windows version are you on?

PhilipNelson5 commented 1 year ago

Version 21H2 OS Build 22000.2538

widavies commented 10 months ago

@PhilipNelson5 Any better luck on a more recent update of Windows 11?

widavies commented 10 months ago

@PhilipNelson5 Try on the latest pre-release here and let me know if it works.

PhilipNelson5 commented 10 months ago

I'm on 2.0.7, 2.0.8 and 2.0.9 immediately crash. Is there a good way to get logs? The terminal that spawns does not stay open long enough to read the output.

widavies commented 9 months ago

@PhilipNelson5 If you open Windows Event Viewer and go to the Application section, you should be able to see a Error message for WinJump:

image

widavies commented 9 months ago

@PhilipNelson5 See if 2.0.10 fixes the crashing: https://github.com/widavies/WinJump/releases/tag/2.0.10

widavies commented 7 months ago

@PhilipNelson5 Is it still crashing? Did you get it to work?

PhilipNelson5 commented 7 months ago

I actually changed jobs and got a new laptop and haven't been using winjump lately. When I get it setup again I'll keep an eye on it.

justinhhorner commented 2 months ago

I've been experiencing this behavior as well where switching virtual desktops does not set focus to the previously focused window on the destination desktop.

In addition to the focus issue, every time I switch desktops, I notice a "Program Manager" window appears quickly during the switch.

I'm working on a way to resolve both issues.

Running Windows 11 Version 23H2 (OS Build 22631.4037)

Video

https://github.com/user-attachments/assets/3eed0f21-7e5b-489b-bca8-a455008eae24

Update (8/28/24)

After spending some more time testing it seems this behavior is not consistent and likely caused by something else in my setup. I'm leaving this for now, but will return to it if others report it.

widavies commented 2 months ago

@justin-horner I've had the same trouble trying to track down this issue. It's very intermittent and seemingly depends on the specific Windows version and environment, or even time of day.

The Program Manager flashing is a trick I've seen suggested by VirtualDesktop where by passing focus to the program manager, it will pass it back to the active window after the virtual desktop switches. In practice, it doesn't seem to work very well so we could try removing it.

Maybe there's something else in the winuser.h API that we could use, otherwise we will have to wait for Microsoft to make their (internal) Virtual Desktop API not hit this bug.