Notes

Ubuntu - Resize windows

author: Paul Kim

categories: ubuntu

tags: ubuntu

Resize windows with wmctrl

Install/Uninstall wmctrl:

# install
sudo apt install wmctrl

# uninstall
sudo apt purge wmctrl

Use wmctrl:

# get a list of windows managed by the window manager
wmctrl -l

# resize currently active window to 800px x 600px
# syntax: wmctrl -r :ACTIVE: -e 0,LEFT,TOP,WIDTH,HEIGHT
wmctrl -r :ACTIVE: -e 0,0,0,800,600

# resize window with window-title = paul@paul-VirtualBox to 800px x 600px
# syntax: wmctrl -r WINDOW_TITLE -e 0,LEFT,TOP,WIDTH,HEIGHT
wmctrl -r paul@paul-VirtualBox -e 0,0,0,800,600

# resize window with window-id = 0x036000dc to 800px x 600px
# syntax: wmctrl -i -r WINDOW_ID -e 0,LEFT,TOP,WIDTH,HEIGHT
wmctrl -i -r 0x036000dc -e 0,0,0,800,600

More examples:

# get a list of windows managed by the window manager
# the first column contains the window id as a hexadecimal integer
# the second column always contains the desktop number (a -1 is used to identify a sticky window)
wmctrl -l

# get a list of windows with PID and geometry information
# 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
wmctrl -p -G -l

# go 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'

# toggle 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"

ChromeEdgeFirefoxOpera

© 2021 paulkode.com. All rights reserved.