Commands

Snapshot

Capture a screenshot and get the window tree:

deskctl snapshot
deskctl snapshot --annotate

With --annotate, colored bounding boxes and @wN labels are drawn on the screenshot. Each window gets a unique color from an 8-color palette. Minimized windows are skipped.

The screenshot is saved to /tmp/deskctl-{timestamp}.png.

Click

Click the center of a window by ref, or click exact coordinates:

deskctl click @w1
deskctl click 960,540

Double click

deskctl dblclick @w1
deskctl dblclick 500,300

Type

Type a string into the focused window:

deskctl type "hello world"

Press

Press a single key:

deskctl press enter
deskctl press tab
deskctl press escape

Supported key names: enter, tab, escape, backspace, delete, space, up, down, left, right, home, end, pageup, pagedown, f1-f12, or any single character.

Hotkey

Send a key combination. List modifier keys first, then the target key:

deskctl hotkey ctrl c
deskctl hotkey ctrl shift t
deskctl hotkey alt f4

Modifier names: ctrl, alt, shift, super (also meta or win).

Mouse move

Move the cursor to absolute coordinates:

deskctl mouse move 100 200

Mouse scroll

Scroll the mouse wheel. Positive values scroll down, negative scroll up:

deskctl mouse scroll 3
deskctl mouse scroll -5
deskctl mouse scroll 3 --axis horizontal

Mouse drag

Drag from one position to another:

deskctl mouse drag 100 200 500 600

Focus

Focus a window by ref or by name (case-insensitive substring match):

deskctl focus @w1
deskctl focus "firefox"

Close

Close a window gracefully:

deskctl close @w2
deskctl close "terminal"

Move window

Move a window to an absolute position:

deskctl move-window @w1 0 0
deskctl move-window "firefox" 100 100

Resize window

Resize a window:

deskctl resize-window @w1 1280 720

List windows

List all windows without taking a screenshot:

deskctl list-windows

Get screen size

deskctl get-screen-size

Get mouse position

deskctl get-mouse-position

Screenshot

Take a screenshot without the window tree. Optionally specify a save path:

deskctl screenshot
deskctl screenshot /tmp/my-screenshot.png
deskctl screenshot --annotate

Launch

Launch an application:

deskctl launch firefox
deskctl launch code --args /path/to/project

Global options

FlagEnvDescription
--jsonOutput as JSON
--socket <path>DESKCTL_SOCKETPath to daemon Unix socket
--session <name>Session name for multiple daemons (default: default)