How to manipulate Xorg windows with a terminal command.

Posted: September 12, 2017. At: 11:20 AM. This was 2 weeks ago. Post ID: 11315

The Windows in an Xorg session may easily be manipulated with this simple utility.

Xdotool. This is a terminal utility to manage Xorg windows.

Firstly, install this simple utility.

[email protected]:~$ sudo apt install xdotool

Then we can resize a MATE Terminal window.

xdotool search --onlyvisible --classname "gnome-terminal" windowsize %@ 500

This example will focus the Firefox URL bar.

[email protected]:~$ xdotool search "Mozilla Firefox" windowactivate --sync key --clearmodifiers ctrl+l
Defaulting to search window name, class, and classname

This final example will search for a MATE Terminal window and open pstree in it.

[email protected]:~$ xdotool search --onlyvisible --classname "mate-terminal" exec /usr/bin/pstree

This is a strange, but useful Linux utility. Give this a try and see what you can come up with.

No comments have been made. Use this form to start the conversation :)

Leave a Reply