@mitu I wrote it on Debian 12 with gnome fallback mode (x11)
Edit: I have now tested on Debian with wayland and it seems to work the same. The window refocus if I Alt-Tab. Although it seems that the standard emulationstation executable does not minimize on wayland for me for some reason.
I made a separate script that skips if wayland is in use as I have no issues with it and the first script introduced some weird behaviour..