wide screen
xdotool - fake keyboard/mouse input, window management, and more

 xdotool can be used to automate activities regarding window managers using Xorg (GUI) on Linux. This article shows some usages of xdotool and comments on related topics. Note that it seems that xdotool does not support Wayland.   I have not found alternatives to xdotool which support wayland. 

 The following command sends alt+F4 to the first window which has "Terminal" in its name. The affected program can prevent the closing of the window.

Note that --clearmodifiers is used in order to clear active keyboard modifiers during keystrokes. Also, one should not use keydown instead of key . The command keydown presses the given keys as long as it is active and could therefore close multiple windows unintentionally in this case.

And finally keep in mind, that not every window supports the keyboard shortcut alt+F4 . For this case command line tools like wmctrl can be used in order to close windows gracefully.

The subsequent command destroys the first window which has "Notepad++" in its name without user interaction. The client controlling the window is also killed and will not prevent this command.