Skip to content

About Snapshots

Scott Perry edited this page Oct 17, 2013 · 1 revision

Especially useful when windows are being improperly included in or omitted from Switch's interface, snapshots consist of a text file and a collection of window screenshots. The text file contains the raw description of all visible windows from Switch's data source, and abbreviated results after two levels of filtering. Each of the raw descriptions include a window identifier which is used to associate the description with a screenshot of the window, if one could be made. The entire text file and the screenshots of the improperly missing/present windows are very useful when writing heuristics to handle these quirks, so please include them in your issues!

Taking a Snapshot

-clicking on Switch's menu bar item reveals advanced options. Select Take Snapshot… and wait a moment as Switch captures the window list and screenshots and saves them. When the snapshot has finished, Switch will open the logs folder. The contents of the snapshot are stored in directories like snapshot-1381991847, the numeric portion representing the time the snapshot was taken (higher number, newer snapshot).

windowlist.txt

The window list has three sections, the first of which is the raw description of the window:

{
    kCGWindowAlpha = 1;
    kCGWindowBounds =     {
        Height = 368;
        Width = 681;
        X = 28;
        Y = 351;
    };
    kCGWindowIsOnscreen = 1;
    kCGWindowLayer = 0;
    kCGWindowMemoryUsage = 316020;
    kCGWindowName = apps;
    kCGWindowNumber = 149646;
    kCGWindowOwnerName = Finder;
    kCGWindowOwnerPID = 175;
    kCGWindowSharingState = 1;
    kCGWindowStoreType = 2;
},

A quick rundown of the format (more details can be found in the Constants section of the Quartz Window Services Reference):

  • kCGWindowAlpha is the alpha channel component for the entire window. 1 is opaque.
  • kCGWindowBounds is the frame of the window in screen coordinates.
  • kCGWindowIsOnscreen should always be 1.
  • kCGWindowLayer (loosely) indicates the type of window. Switch filters out windows that have values other than 0.
  • kCGWindowMemoryUsage is an estimate of the amount of memory being used by the window and its supporting objects.
  • kCGWindowName is the name of the window. Switch filters out most windows that have an empty window name, and most quirks are exceptions to this rule that range from simple to rather complicated.
  • kCGWindowNumber is the window ID that is used as a unique key to refer to the window, both by OS X and by Switch. The screenshot of this window has this number as part of its filename.
  • kCGWindowOwnerName is the name of the application that owns this window.
  • kCGWindowOwnerPID is the process ID of the application that owns this window.
  • kCGWindowSharingState specifies whether and how this window is shared with other applications.
  • kCGWindowStoreType specifies the kind of backing store and drawing semantics of the window.

The next two sections contain shorter lists of windows after progressive amounts of filtering. The windows are described like:

0x10131ece0 <149646 (apps)>,

The first bit of hex isn't useful (it's the address of the window object), the decimal number in the angle brackets is the window ID (matching the kCGWindowNumber of the window's description, above), and the string in the parentheses is the window name (matching kCGWindowName in the description, or (null) if not set).

Clone this wiki locally