How to show a window using command line on Mac

I usually work with multiple open WebStorm projects (sometimes 5 or 6) and it gets really annoying that I have to keep searching all the desktops to find the right one. To make matters worse, my Mac sometimes reverses the order of the desktops, so I really can't know where the project is and search through everything.

Does anyone know if there is a command line that I can run to show a specific window? e.g. I have a terminal window open with 3 tabs, Projects 1, 2 and 3, and I want to go to the terminal tab of project 2 and type something to show me the desktop that displays the WebStorm Project 2 window. Is it possible is it at all?

I know that I can run $ wstorm .

to open the project, but if I run it with the project already open, nothing happens.

Thank!

+3


source to share


1 answer


The osascript command can be used if the window names contain text that can be used to identify them. Using TextEdit as an example, opening two windows, one for file "file1.txt" and one for "file2.txt", the following command will show a window for file "file2.txt"



osascript -e $'activate application "TextEdit"\ntell application "TextEdit" to set index of window 1 where name contains "file2" to 1'

      

0


source







All Articles