When playing Minecraft in fullscreen, if another application takes focus, or a desktop notification appears, Minecraft "minimizes" but still has control of my mouse. My keyboard works fine, applications keep running, and I can even move my mouse, but mouse clicks don't register. The only options I've found are to…
a) Regain Minecraft's focus with a hotkey (Super + number key
; the same as clicking an icon in the launcher). The problem with this is that if the Minecraft icon is too far down the launcher, there's no hotkey to launch it.
b) Kill the application. Since my keyboard still works, I can hit Alt + F2
and killall java
without much hassle. The cons of this method are obvious.
So I need two solutions:
-
How do I prevent this from happening?
-
How do I more reliably give the focus back to my Minecraft (java) process should this happen again, without relying on it being higher up on my launcher?
I don't have any issues running Minecraft in a window, even if it's been maximized by clicking the square icon.
Best Answer
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)Thus a complete recipe could be
DISPLAY=:0 wmctrl -a "Minecraft 1.10"
See this other answer for more details on wmctrl.