how can i use the currently active terminal and execute commands in it

Answered

I have now implemented opening a terminal and executing commands, but I encountered a problem: every time I open a new tab, it takes 2 to 3 seconds to load. Is there a way to use the currently active terminal and execute commands in it? Only if there is no active terminal should I create a new one.

0
1 comment

Hi,

Do you want to use a terminal that user could open manually? Executing your command in such a tab would be bad from the UX perspective. Maybe a user wants to decide for themselves if they want your command to be executed in an existing tab. They could have multiple terminal tabs for different purposes.

Technically, you can try to find the Terminal tool window and iterate its Content objects with ContentManager:

val toolWindow = //find Terminal tool window
toolWindow.contentManager.contents.find { ... }
1

Please sign in to leave a comment.