Skip to content
macOS command line utility to retrieve the CGWindowID of the specified window (useful for screencapture).
Branch: master
Clone or download
Latest commit e21a8df Jun 5, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Create FUNDING.yml Jun 5, 2019
.gitignore
.travis.yml Enable Travis CI. Dec 14, 2017
GetWindowID.m Add a warning if the process is not running within a Quartz GUI session. Dec 14, 2017
LICENSE Specify license Mar 25, 2014
Makefile Initial commit Jun 2, 2013
README.md Mention Homebrew in README.md. #3 Dec 18, 2017

README.md

Build Status

GetWindowID

macOS command line utility to retrieve the CGWindowID of the specified window (useful for screencapture).

Installation

Via Homebrew:

brew install smokris/getwindowid/getwindowid

Usage

./GetWindowID <application-bundle-name> <window-title>

For example, to get the ID of the iOS/tvOS/watchOS Simulator:

./GetWindowID Simulator 'iPhone X - iOS 11.0'

…and to capture a screenshot of it:

screencapture -l$(./GetWindowID Simulator 'iPhone X - iOS 11.0') simulator.png

To get the ID of a window without a title, pass an empty string as the title:

./GetWindowID GLFW ''

To list all of an app's windows, pass --list as the title:

./GetWindowID Simulator --list
You can’t perform that action at this time.