Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mac - List opened windows in terminal

I want to list opened windows in the terminal to get x, y, width and height like xwininfo -root -tree for X11.

I tried:

osacript -e tell application "Microsoft Word" to get the bounds of the front window

But it's does not work for all Application and you can't specify a child (If you have two Word Document, it return the first opened).

like image 571
Tokytok Avatar asked Apr 12 '12 13:04

Tokytok


People also ask

How do I see tabs in Mac terminal?

In the Terminal app on your Mac, do one of the following: Press Command-T. Choose Shell > New Tab > New Tab with Profile. The name of the profile that opens is concatenated to the end of the New Tab with Profile menu item.

How do I open multiple windows in Terminal?

Using the tab context menu If you'd like to open a new pane of a profile that is already open in your terminal, you can right click on the tab and click Split Tab. This will duplicate the focused pane in the current tab.

How do I open multiple instances of my Mac?

Trying to use the Finder to open multiple instances of an application on Mac OS X will simply cause the first instance to come to the foreground. To get around this, use the open command from the command line with the -n option. The -n option opens a new instance of the application even if one is already running.


1 Answers

To get the position of all windows:

osascript -e 'tell application "System Events" to get the position of every window of every process'

The size:

osascript -e 'tell application "System Events" to get the size of every window of every process'

The title:

osascript -e 'tell application "System Events" to get the title of every window of every process'

Check the reference in AppleScript Editor for more properties.

like image 105
strkol Avatar answered Oct 19 '22 05:10

strkol