Closing a GUI window from the command line
You could use xkill, xdotool or wmctl.
type xkill on the terminal and then click on the window you want to close.
Jon G - Megaphone Tech
President of Megaphone Technology Consulting (https://megaphonetech.com). If you need to reach me, I'm "junglebird" on https://chat.civicrm.org.
Updated on September 18, 2022Comments
-
Jon G - Megaphone Tech over 1 year
I often run scripts to transform a CSV file which I then preview in LibreOffice. I often open the CSV with
xdg-open file.csv
. However, if I run that command when the file is already open, LibreOffice simply focuses that window - it doesn't reload the file from disk.Is there a way, from the command line, that I can specify a window to close in the GUI? I can't just kill the process, since LibreOffice shares a single pid for all its windows. I'm running the latest version of Cinnamon on Mint 17.1.
-
VaTo about 9 yearstype xkill on the terminal and then click on the window you want to close.
-
guntbert about 9 yearsYou should put this explanation into your answer.
-
Jon G - Megaphone Tech about 9 yearsBased on this, I found xdotool meets my needs: `xdotool search "$FILENAME" windowactivate --sync key --window 0 --clearmodifiers alt+F4.
-
Brōtsyorfuzthrāx over 6 yearsxkill will kill the process (not just close the program).