2

Typing in xdotool getwindowfocus windowkill currently terminates the active window and bypasses any safeguards like "would you like to save your work?". Is there a weaker command than windowkill I can here use that won't make such bypasses?

2

The soft way to request an X11 application to close its window and possibly then exit is to send it a WM_DELETE_WINDOW message.

Xdotool doesn't appear to have a way to do this. You can do it in Perl with X11::Protocol::WM. Untested:

perl -MX11::Protocol -MX11::Protocol::WM -e '$X = X11::Protocol::new(); X11::Protocol::WM::set_wm_protocol($X, ($X->GetInputFocus())[0], "WM_DELETE_WINDOW")'

Alternatively, wmctrl can do that:

wmctrl -c :ACTIVE:

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.