The [screen] command.

Introduction

The screen command lets you obtain information about the screens currently connected to the machine.

Synopsis

The formal syntax of the [screen] command is:
screen subcommand ?options?
The possible subcommands are described below. Depending on the subcommand, some options may be specified.

Screen subcommands

The [count] subcommand

This subcommand returns the current number of screens. The complete syntax is:
    screen count
The returned value should not be cached as screens can be added, removed, or dynamically reconfigured at any time.

The [current] subcommand

This subcommand returns the screen containing a given document window. The complete syntax is:
    screen current ?-w win?
The returned value is the index of the screen containing the specified window. When the window is partly on one screen and partly on another, the screen where most of it lies is returned.
If the -w option is not specified, the command applies to the frontmost document window or raises an error is no window is opened.

The [description] subcommand

This subcommand returns information about a given screen. The complete syntax is:
    screen description num
The num argument is the index of the screen among the list of all screens.
The command returns a dictionary with the following keys:
KeyDescription
bitsPerSamplebit depth of the display’s raster image
colorSpacename of the display’s color space
resolutionraster resolution in dots per inch
sizesize of the display’s frame rectangle

The [frame] subcommand

This subcommand returns the frame coordinates of a screen. The complete syntax is:
    screen frame ?-v? num
The num argument is the index of the screen among the list of all screens. The screen at index 0 corresponds to the primary screen of the user's system which is not necessarily the main screen (obtained using the [screen main] command).
The command returns a list containing the x-coord and y-coord of the origin and the width and height of the rectangle defining the device. If the -v option is specified, it returns the visible frame based on the current user-interface settings and not including the area currently occupied by the dock and menu bar.

The [main] subcommand

This subcommand returns the index of the main screen. The complete syntax is:
    screen main
The main screen is not necessarily the same screen that contains the menu bar: it refers to the screen containing the window that is currently receiving keyboard events.

Examples

Here are a few examples of use with a two displays installation. Open the Tcl Shell (with ⌘Y) and enter the following commands, one by one:
«» screen count
2
«» screen main
1
«» screen frame 0
0.0 0.0 1440.0 900.0
«» screen frame -v 0
0.0 74.0 1440.0 804.0
«» screen frame 1
1440.0 -180.0 1920.0 1080.0
«» screen frame -v 1
1440.0 -180.0 1920.0 1057.0
«» screen description 0
bitsPerSample 8 colorSpace NSCalibratedRGBColorSpace resolution {72.0 72.0} size {1440.0 900.0}
«» screen current -w "* Tcl Shell *"
1


Last updated 2019-10-17 13:29:18