How to recover focus after losing it while using Wine

I was able to solve this for my setup --- I'm using Wine play Hearthstone through Lutris. The trick is to edit the registry using regedit in Wine for this particular game, following this user's suggestion:

  • Open Regedit
  • Go to HKEY_CURRENT_USER\Software\Wine\X11 Driver
  • Create a new entry named "UseTakeFocus" with value "N"

This not only fixed my alt-tabbing issues, I was able to modify the window size and change between fullscreen and windowed mode in-game with only the expected behavior!

Specifically in Lutris, I selected the game (Hearthstone), clicked "Wine registry", and added the value in Regedit as suggested (when creating the new entry, it's right click, add key, String value; then right click modify it to make the value "N"). Then close out; the registry should be saved (but you can edit it again to double check that the new value is there). Then launch the game and the new behavior is in place.

I expect this doesn't work across games, because it depends the game having proper support for Desktop keyboard shortcuts and window management modifications.

Switching desktops did the trick for me.

I use Openbox, and have hit this snag in FlStudio 10, it seems to me that the wineserver will allow you to alt-tab out, and back in, however sometime after doing it once it stops the alt-tab window from showing. Like I said I use Openbox, so my experience might be different, all I have to do is hold the alt button press tab once then proceed to switch desktops (mouse-wheel). since I don't use unity, I'm not certain that that is the default binding there, but it does seem to be a common binding. Do be careful some games/programs don't like this, for instance Command and Conquer 3 will almost certainly crash, be sure to save first!!!