3

I've been having a segfault problem with matlab, it will die and leave the gui hanging around, to which the close button does nothing.

I've since fixed the matlab issue, but for future reference, I'd like to know how to find and kill this window. The window is not tied to a process (as far as I can tell with ps -aux | grep matlab), and appears to be a "zombie" window.

Does this have to be done through x, or is there a process I just can't see?

1
  • Does xprop or xlsclients give any indication to which process this window belongs? AFAIK all windows belonging to an X client disappear automatically if the client disconnects. Possibly lsof | grep X11 also helps, at least processes using the X11 libraries should show up. – dirkt Sep 7 '17 at 14:14
4

The easiest way is running "xkill" on the command line and select the zombie window. It will be killed.

More information: https://www.howtoforge.com/tutorial/linux-kill-process-with-xkill/

1

Here's a one-liner that uses xdotool and which you can bind to a hotkey:

bash -c 'if [ -z $(pgrep -f "^xdotool selectwindow windowkill$") ]; then xdotool selectwindow windowkill & else pkill -f "^xdotool selectwindow windowkill$"; fi'

The next window you click after triggering this will have its client process killed. Running the script a second time before clicking anything will cancel it.

You could also just do xdotool selectwindow windowkill, but then you wouldn't be able to exit the "kill mode" after activating it. The longer version lets you press the hotkey once to enter the "kill mode", and a second time to disable it if you change your mind.

2
  • 1
    You talk about "kill mode". What is it, and how does one use it? … … … … … … … … … Please do not respond in comments; edit your answer to make it clearer and more complete. – G-Man Says 'Reinstate Monica' Jul 4 '20 at 3:10
  • Please do not post the same answer to multiple questions. If the same information really answers both questions, then one question (usually the newer one) should be closed as a duplicate of the other. You can indicate this by voting to close it as a duplicate or, if you don't have enough reputation for that, raise a flag to indicate that it's a duplicate. Otherwise tailor your answer to this question and don't just paste the same answer in multiple places. – DavidPostill Jul 4 '20 at 7:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.