Wmctrl

From wikinotes

A tool to control linux UI from the terminal.

Usage

# list all window-ids by desktop-id
wmctrl -l     # ${window_id} ${desktop_id} ${hostname} ${window_title}
wmctrl -l -G  # ${window_id} ${desktop_id} ${x_offset} ${y_offset} ${width} ${height} ${hostname} ${window_title}

# list desktops
wmctrl -d     # ${desktop_id} ${star_current_desktop} DG: ${width}x${height} VP: ${viewport_y},${viewport_y} WA: ${pos_x}x${pos_y} ${width}x${height}

wmctrl -a 'STRING'  # focus window whose name contains 'STRING'