exwm
exwm copied to clipboard
Is there a hook for when a window closes itself?
Hey there. Basic question but I've searched all through the source and haven't been able to find this.
Is there a hook that triggers when a (X)window which EXWM is managing quits of its own accord, i.e., is not KILLED by EXWM, but rather that particular (X)window closes?
Preferably this hook would run before information like the exwm-class-name or exwm-title are lost.
The use case is that I have a (sub-)window for a program, which I split the Emacs window for, so that the main window appears above the subwindow in Emacs. When the subwindow exits, I would want the main window to reoccupy that space by removing the window that the subwindow just occupied using (delete-window).
So far I've only found hooks that trigger based on EXWM killing the window, but not the program killing the window itself.
I'm unsure if I'm just missing something obvious or if this is something I will have to hack together.
If I understand correctly, EXWM actually does kill the buffer when the X server notifies it that the window is to be destroyed. So you might be able to hook into Emacs' own kill-buffer-hook
, which should run right before the buffer is killed. You could check whether it is an EXWM buffer e.g. by examining the major-mode or EXWM's buffer-local variables like exwm--id
(internal variable though).