WMCTRL(1)

๐Ÿ“ฆ
version 1.07+git20240228.1105759 ยท 4 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

โœจ wmctrl(1) โœจ

okay so bestie, welcome to wmctrl โ€” it's in the General Commands Manual, section 1, and it's the little command that lets you talk to your window manager. ๐Ÿ’…


๐ŸŒธ NAME ๐ŸŒธ

wmctrl โ€” interact with a EWMH/NetWM compatible X Window Manager. that's it, that's the whole vibe. ๐Ÿฆ‹


๐ŸŽ€ SYNOPSIS ๐ŸŽ€

wmctrl [ options | actions ]...

๐Ÿ’– DESCRIPTION ๐Ÿ’–

So wmctrl is a command you use to interact with an X Window manager that's compatible with the EWMH/NetWM specification. It can query the window manager for information, and it can request that certain window management actions be taken. asking nicely, basically. ๐Ÿซถ

wmctrl is controlled entirely by its command line arguments. Those arguments specify the action to be performed (plus options that modify behavior) and any arguments that might be needed to actually do the thing.

The sections below define the supported actions and options. Arguments to the actions and options are written in the form <ARGNAME> in the descriptions. The detailed syntax for writing arguments lives in one single section dedicated to that purpose. iykyk โœจ


๐Ÿ”ฅ ACTIONS ๐Ÿ”ฅ

These command line arguments invoke a wmctrl action. And listen โ€” only one action can be executed with the invocation of the wmctrl command. one. single. action. periodt. ๐Ÿ‘‘

  • -a <WIN> โ€” Switch to the desktop containing the window <WIN> (see below), raise the window, and give it focus. main character energy, immediately.
  • -b ( add | remove | toggle),prop1 [,prop2 ] โ€” Add, remove, or toggle up to two window properties simultaneously. The window being modified must be identified with a -r action. The property change is achieved by using the EWMH _NET_WM_STATE request. The supported property names (for prop1 and prop2) are modal, sticky, maximized_vert, maximized_horz, shaded, skip_taskbar, skip_pager, hidden, fullscreen, above and below. Two properties are supported to allow operations like maximizing a window to full screen mode. Note that this action is made up of exactly two shell command line arguments. two, not one, not three. ๐Ÿ’€
  • -c <WIN> โ€” Close the window <WIN> gracefully. gentle. polite. no violence.
  • -Y <WIN> โ€” Iconify the window <WIN>.
  • -d โ€” List all desktops managed by the window manager. One line is output for each desktop, with the line broken up into space separated columns:
    • The first column contains an integer desktop number.
    • The second column contains a '*' character for the current desktop, otherwise it contains a '-' character.
    • The next two columns contain the fixed string DG: and then the desktop geometry as '<width>x<height>' (e.g. '1280x1024').
    • The following two columns contain the fixed string VP: and then the viewport position in the format '<x>,<y>' (e.g. '0,0').
    • The next three columns after this contain the fixed string WA: and then two columns with the workarea geometry as 'X,Y and WxH' (e.g. '0,0 1280x998').
    • The rest of the line contains the name of the desktop (possibly containing multiple spaces).
  • -e <MVARG> โ€” Resize and move a window that has been specified with a -r action according to the <MVARG> argument.
  • -g w,h โ€” Change the geometry (common size) of all desktops so they are w pixels wide and h pixels high. w and h must be positive integers. A window manager may ignore this request. ๐Ÿ™ˆ
  • -h โ€” Print help text about program usage.
  • -I name โ€” Set the icon name (short title) of the window specified by a -r action to name.
  • -k ( on | off | toggle ) โ€” Turn on or off or toggle the window manager's "show the desktop" mode (if the window manager implements this feature). the "if" is doing a lot of work there ngl.
  • -M path โ€” Set the mini-icon of the window specified by a -r action to the xpm bitmap in path.
  • -l โ€” List the windows being managed by the window manager. One line is output for each window, with the line broken up into space separated columns:
    • The first column always contains the window identity as a hexadecimal integer.
    • The second column always contains the desktop number (a -1 is used to identify a sticky window).
    • If the -p option is specified the next column will contain the PID for the window as a decimal integer.
    • If the -G option is specified then four integer columns will follow: x-offset, y-offset, width and height.
    • The next column always contains the client machine name.
    • The remainder of the line contains the window title (possibly with multiple spaces in the title).
  • -m โ€” Display information about the window manager and the environment. the vibe check of window managers fr fr.
  • -n N โ€” Change the number of desktops to N (a non-negative integer).
  • -N name โ€” Set the name (long title) of the window specified by a -r action to name.
  • -o x,y โ€” Change the viewport for the current desktop. The values x and y are numeric offsets that specify the position of the top left corner of the viewport. A window manager may ignore this request. again. ๐Ÿ™ˆ
  • -r <WIN> โ€” Specify a target window for an action.
  • -R <WIN> โ€” Move the window <WIN> to the current desktop, raise the window, and give it focus.
  • -s <DESK> โ€” Switch to the desktop <DESK>.
  • -t <DESK> โ€” Move a window that has been specified with the -r action to the desktop <DESK>.
  • -T name โ€” Set the both the name (long title) and icon name (short title) of the window specified by a -r action to name. This action is like using the -N and -I actions at the same time (which would otherwise be impossible since wmctrl can execute only one action at a time). two for one, we love a deal. ๐ŸŽ€

๐Ÿ’… OPTIONS ๐Ÿ’…

These options modify the default actions, or they modify the interpretation of arguments. tiny little knobs, huge consequences.

  • -F โ€” Window name arguments (<WIN>) are to be treated as exact window titles that are case sensitive. Without this options window titles are considered to be case insensitive substrings of the full window title.
  • -G โ€” Include geometry information in the output of the -l action.
  • -S โ€” List windows in stacking order (bottom to top).
  • -i โ€” Interpret window arguments (<WIN>) as a numeric value rather than a string name for the window. If the numeric value starts with the prefix '0x' it is assumed to be a hexadecimal number.
  • -p โ€” Include PIDs in the window list printed by the -l action. Prints a PID of '0' if the application owning the window does not support it. not its fault, it's the app's fault.
  • -u โ€” Override auto-detection and force UTF-8 mode.
  • -v โ€” Provide verbose output. This is really useful when debugging wmctrl itself. ๐Ÿ”
  • -w [ <WORKAROUND>[,<WORKAROUND>]... ] โ€” Use workarounds specified in the argument.
  • -x โ€” Include WM_CLASS in the window list or interpret <WIN> as the WM_CLASS name.

๐Ÿฆ‹ ARGUMENTS ๐Ÿฆ‹

  • <DESK> โ€” A Desktop is always specified by an integer which represents the desktop numbers. Desktop numbers start at 0.
  • <MVARG> โ€” A move and resize argument has the format 'g,x,y,w,h'. All five components are integers. The first value, g, is the gravity of the window, with 0 being the most common value (the default value for the window). Please see the EWMH specification for other values. The four remaining values are a standard geometry specification: x,y is the position of the top left corner of the window, and w,h is the width and height of the window, with the exception that the value of -1 in any position is interpreted to mean that the current geometry value should not be modified. pass -1, keep what you got. iconic.
  • <WIN> โ€” This argument specifies a window that is the target of an action. By default the argument is treated as if were a string, and windows are examined until one is found with a title that contains the specified string as a substring. The substring matching is done in a case insensitive manner. The -F option may be used to force exact, case sensitive title matching. The option -i may be used to interpret the window target as a numeric window identity instead of a string. The window name string :SELECT: is treated specially. If this window name is used then wmctrl waits for the user to select the target window by clicking on it. ๐Ÿ‘† The window name string :ACTIVE: may be used to instruct wmctrl to use the currently active window for the action.
  • <WORKAROUND> โ€” There is only one work around currently implemented. It is specified by using the string DESKTOP_TITLES_INVALID_UTF8 and it causes the printing of non-ASCII desktop tiles correctly when using Window Maker.

๐ŸŒˆ EXAMPLES ๐ŸŒˆ

Getting a list of windows managed by the window manager

wmctrl -l

Getting a list of windows with PID and geometry information.

wmctrl -p -G -l

Going to the window with a name containing 'emacs' in it

wmctrl -a emacs

Shade a window with a title that contains the word 'mozilla'

wmctrl -r mozilla -b add,shaded

Close a very specifically titled window sticky

wmctrl -F -c 'Debian bug tracking system - Mozilla'

Set the 'stickiness' of a window with a specific window identity

wmctrl -i -r 0x0120002 -b add,sticky

Change the title of window to a specified string but choose the window by clicking on it

wmctrl -r :SELECT: -T "Selected Window"

๐Ÿ‘€ SEE ALSO ๐Ÿ‘€

zenity(1) is a useful dialog program for building scripts with wmctrl. the duo. the collab. ate.

Some examples of EWMH/NetWM compatible window managers include recent versions of Enlightenment, Icewm, Kwin, Sawfish and Xfce.


๐Ÿ’œ AUTHOR ๐Ÿ’œ

wmctrl was written by Tomas Styblo <tripie@cpan.org>. ๐Ÿ‘‘

This manual page was written by Shyamal Prasad <shyamal@member.fsf.org> for the Debian project (but may be used by others).


and that's the whole page bestie!! ๐ŸŽ€โœจ this one came from the General Commands Manual and it's dated December 12, 2004 โ€” so it's been slaying in wmctrl(1) for literal decades. ๐Ÿ’– ๐Ÿฆ‹ go forth and manage those windows. periodt. ๐Ÿ’…๐ŸŒธ