Window focus is lost when using Show Desktop
Opened this issue · 3 comments
Pressing "Show Desktop" once minimizes windows to reveal the desktop. Pressing "Show Desktop" a second time restores windows, but on v3.6.0 it does not restore the window focus, requiring some additional input from the user before we can interact with the restored windows. This is true whether the "Show Desktop" taskbar button is used, or the KeySysShowDesktop shortcut, or even icesh desktop 1|0
.
I tried booting a system snapshot with IceWM 3.4.1 and there "Show Desktop" worked as I expected/remembered, restoring the windows and focus when pressed a second time. I then updated only IceWM on that snapshot to 3.6.0 and the behavior of "Show Desktop" changed to what I described above. Window focus is not restored when pressing Show Desktop a second time even though the windows themselves are.
I think this means the issue is not caused by any other app or by a setting in my user preferences file, though possibly there is a new preference that I need to change?
Testing this more, it seems to only happen if you have an application occupying the desktop layer, such as a desktop icon manager or a terminal window set as the Dekstop layer. I guess this is because that application takes the focus when switching to Show Desktop, but doesn't give back the focus when "Unshowing" the desktop.
Again, though, this was not the behavior in IceWM 3.4.1 and earlier. Even when using an app as the desktop. Pressing Show Desktop a second time returned the focus to the previously focused window.
I'll look into it later. Thanks for reporting this.
In the mean time, can you use the doNotFocus
winoption?
Did you think of that solution? Why not?
I just tried setting doNotFocus for my desktop layer app (urxvt) and that does allow a second press of Show Desktop to return focus to the previously focused window. But of course it also means the app on the desktop layer doesn't focus after the first press of Show Desktop, so there's no way to interact with it.
You may have already made this connection, but in case not, I see this in the changelog for v3.4.6
When undoing an arrange or showing the desktop, focus the last focused window instead of the topmost window.
So that's almost certainly the cause of this. I had never noticed before, but I do confirm that the behavior in 3.4.1 is to focus the topmost window after undoing Show Desktop, not actually the previously focused window if it wasn't on top. In 3.6.0 it really is the previously focused window as long as there's not a desktop layer app that grabs the focus first.
If there's no simple way to return focus to the last focused window even when a desktop layer app has grabbed focus inbetween, maybe there could be preference to switch between the old way and the new way.