Wmctrl - Command Line Window Manager Control

Control your X Window Manager with wmctrl. This command-line tool allows you to list, switch, move, and manipulate windows and workspaces efficiently.

Wmctrl - Command Line Window Manager Control

Wmctrl is a powerful command-line utility for interacting with the EWMH/NetWM compatible X Window Manager. It allows users to control windows, workspaces, and manipulate their properties directly from the terminal, enhancing productivity for Linux users.

What is Wmctrl?

Wmctrl provides a command-line interface to manage your graphical environment. It's particularly useful for scripting window operations, automating tasks, or for users who prefer keyboard-driven workflows. You can list all open windows, switch between them, move them to different workspaces, and even toggle their states like fullscreen or maximized.

Key Wmctrl Commands and Usage

Here are some essential wmctrl commands to get you started:

# List all windows, managed by the window manager:
wmctrl -l

# Switch to the first window whose (partial) title matches:
wmctrl -a window_title

# Move a window to the current workspace, raise it and give it focus:
wmctrl -R window_title

# Switch to a workspace:
wmctrl -s workspace_number

# Select a window and toggle fullscreen:
wmctrl -r window_title -b toggle,fullscreen

# Select a window and move it to a workspace:
wmctrl -r window_title -t workspace_number

Advanced Wmctrl Features

Beyond basic window switching, wmctrl offers more granular control. You can use it to manage window properties, such as changing their geometry, setting hints, or activating specific window states. This makes it an indispensable tool for power users and system administrators looking to automate desktop environments.

Integrating Wmctrl with Scripts

The true power of wmctrl lies in its scriptability. By combining wmctrl commands with shell scripting, you can create custom workflows. For example, you could write a script that automatically arranges specific applications on designated workspaces when you log in, or one that quickly switches between different project layouts.

Further Resources