Search code examples
rubymine

Is it possible to configure RubyMine to shift focus to run window, when you run a ruby script? (Shift+F10)


I write some Ruby programs that use standard input and output. When I run a script within RubyMine (Shift+F10), the Run windows pops up, and the output is displayed and the program is waiting for user input, however, the focus is still on editor window. So you can simply start typing, but you have to click on Run window to bring it into focus. Is there a way to have focus automatically shift to Run window?

I figured I can use Alt-4, to switch to Run window, after I run the program, but having it automated would be very nice. I suppose it is just something I got used to working with different (non-Ruby) IDEs.


Solution

  • I believe I found a way to do that. There is a somewhat hidden feature of Rubymine called "Focus on start" (the closest official docs I could find is here). It seems to be intended primarily for the Debug tool window but seems to work for all tool windows that have tabs inside them. So, to try this out, you first need to make Rubymine to create tabs inside the Run tool window. To do that, you can add a log file to the window.

    Try the following steps:

    • Open up the Edit run configuration dialogue for your script and add a log file to be shown in the window. It can be any file you want, even a blank one, you just need to make Rubymine open two tabs in the tool window - one with the Console, the other one with the log file.
    • Run the script and you should see two tabs in the tool window.
    • Now right-click on the Console tab and select the Focus on Startup checkbox.

    Now, try running the script again. You should get the focus inside the Console tab automatically after you run it. At least this is what I get with Rubymine 2016.2.