简体   繁体   English

如何在Mac中使用命令行显示窗口

[英]How to show window using command line in Mac

I usually work with several WebStorm projects opened (sometimes 5 or 6) and it gets really annoying that I have to keep searching through all the Desktops to find the right one. 我经常使用几个打开的WebStorm项目(有时候是5或6个),而且我必须继续搜索所有桌面才能找到合适的项目。 To make it worse, my Mac sometimes changes the order of the desktops, so I really can't know where the project is and have to search through all of them. 更糟糕的是,我的Mac有时会改变桌面的顺序,所以我真的无法知道项目的位置,并且必须搜索所有项目。

Does anyone know if there's a command line that I can run to show a specific window? 有谁知道我是否可以运行命令行来显示特定的窗口? eg I have a terminal window opened with 3 tabs, Projects 1, 2 and 3, and I want to go on Project 2 terminal tab and type something to show me the desktop where the WebStorm window of Project 2 is showing. 例如,我打开了一个带有3个选项卡的终端窗口,项目1,2和3,我想进入Project 2终端选项卡并输入一些内容,以显示Project 2的WebStorm窗口所显示的桌面。 Is this possible at all? 这有可能吗?

I know that I can run $ wstorm . 我知道我可以运行$ wstorm . to open the Project, but if I run it with the project already opened then nothing happens. 打开项目,但是如果我在项目已经打开的情况下运行它,那么没有任何反应。

Thanks! 谢谢!

The osascript command can be used if the window names contain text that can be used to identify them. 如果窗口名称包含可用于标识它们的文本,则可以使用osascript命令。 Using as example TextEdit, having two windows open, one for file "file1.txt" and the other for "file2.txt", then the following command will show the window for "file2.txt" 使用示例TextEdit,打开两个窗口,一个用于文件“file1.txt”,另一个用于“file2.txt”,然后以下命令将显示“file2.txt”的窗口

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM