sometimes when i switch windows(most of the time using my second monitor) and then switch back to minecraft it will not respond. i can't do anything and if i switched windows without using the menu screen(inventories,chat) the game will just continue without me having any control.
After having this issue: Please attach the complete output of the "Development console" which can be found on the second tab of the launcher.
If the launcher closes after game start, please edit your profile and select "Launcher visibility" then, "Keep the launcher open".