How can I keep the focus on the text after running/building?



Here is a very typical workflow when programming:

  • Write some code
  • Press a shortcut that runs a command for building the program and running some tests
  • View the output
  • Go back to editing the code

The problem is that IntelliJ switches focus to the window/panel running the command, for example:

  • Pressing F9 to build the project switches focus to the build panel
  • Running a custom shell script switches focus to the terminal

This means you have to press Alt+F4 or something similar to go back to the text. This seems like a bad design that would only be useful in cases where the user has to input something in the program, which is a much less common usecase than just viewing output/test results.

Is there anyway to run the task in the background without having to switch focus back to the text?



It's possible to set up certain run configuration so the corresponding tool window does not get activated when the configuration is run.

E.g. for the JUnit test it's enough to remove the Before launch option named Open run/debug tool window when started. 

For the shell script there's a similar option named Activate tool window

If this does not help in your case, please indicate what run configuration type(s) you are working with.


That's perfect, thanks!


Please sign in to leave a comment.