There's an option in system settings, something along the lines of keep controller active when window is inactive, select that.

If windows steals focus for a second for some junk it's doing in the background, you can lose your gamepad control.