What do I do when Minecraft in fullscreen loses focus?

Solution 1:

wmctrl tool provides command line access to window manager (not installed by default, the package is named wmctrl). The -a flag permits a user to Activate the window by switching to its desktop and raising it. (Note that you can find the window name with -f option)

$ wmctrl -l
0x01600007 -1 hostname Desktop
0x04200002  0 hostname mouse - What do I do when Minecraft in fullscreen loses focus? - Ask Ubuntu - Google Chrome
0x03200007  0 hostname Terminal
0x03e00015  0 hostname Minecraft 1.10.2
$ wmctrl -a "Minecraft 1.10"

Thus a complete recipe could be

  • Switch to virtual console Ctrl+Alt+F1
  • Login
  • DISPLAY=:0 wmctrl -a "Minecraft 1.10"
  • Switch to x server console Ctrl+Alt+F7 (or F8)

See this other answer for more details on wmctrl.