wmctrl

Command-line window manager control

TLDR

List windows
$ wmctrl -l
Activate window by title
$ wmctrl -a [window_title]
Move window and focus
$ wmctrl -R [window_title]
Switch workspace
$ wmctrl -s [workspace_number]
Toggle fullscreen
$ wmctrl -r [window_title] -b toggle,fullscreen
Move window to workspace
$ wmctrl -r [window_title] -t [workspace_number]

SYNOPSIS

wmctrl [OPTIONS]

DESCRIPTION

wmctrl is a command-line tool for interacting with an X Window Manager that supports the EWMH/NetWM specification. It allows listing, switching, and manipulating windows from scripts or the terminal.Window titles can be partial matches. Multiple actions can be combined.

PARAMETERS

-l

List windows
-a TITLE
Activate window matching title
-R TITLE
Move window to current workspace and focus
-s N
Switch to workspace N
-r TITLE
Select window for action
-b ACTION
Modify window state (toggle, add, remove)
-t N
Move window to workspace N

INSTALL

sudo apt install wmctrl
sudo dnf install wmctrl
sudo pacman -S wmctrl
sudo zypper install wmctrl
brew install wmctrl
nix profile install nixpkgs#wmctrl

CAVEATS

X11 only. Requires EWMH-compliant window manager. Some features depend on window manager support.

SEE ALSO

xdotool(1), xprop(1)