getsyx - Linux


Overview

getsyx retrieves the screen size of your X display, either in pixels or dots.

Syntax

getsyx [-pm] [-g | -s | -d | -D] [<display>]

Options/Flags

  • -p : Output in pixels (default).
  • -m : Output in dots.
  • -g : Get the dimensions of the geometric work area (default).
  • -s : Get the dimensions of the window manager work area.
  • -d : Get the dimensions of the entire physical display.
  • -D : Get the dimensions of the built-in display (Linux only).
  • : An optional X display. If no display is specified, the default X display is used.

Examples

Example 1: Get the geometric work area in pixels:

getsyx -pg

Example 2: Get the physical display dimensions in dots:

getsyx -md

Common Issues

Issue: The command does not work.

Solution: Ensure the X server is running and that you have permission to access the X display.

Integration

getsyx can be used with other commands to automate tasks. For example:

xrandr --output $(getsyx -pg) --auto

This command would automatically set the display resolution to the current geometric work area.

Related Commands

  • xrandr: Configure X displays.
  • xwininfo: Display information about X windows.
  • xdpyinfo: Display information about X displays.