diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-25 11:56:35 -0400 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-25 11:56:35 -0400 |
| commit | 3a68fef38bb3ad21a26f6d0f61bfc50f9016f012 (patch) | |
| tree | 1d2c62560abff8d8205c73a74da4afae90f573e3 /modules | |
| parent | de01036abae7fc717ea186163cafb73b8b9ad900 (diff) | |
| download | dotemacs-3a68fef38bb3ad21a26f6d0f61bfc50f9016f012.tar.gz dotemacs-3a68fef38bb3ad21a26f6d0f61bfc50f9016f012.zip | |
fix(dirvish): reap the Super+F popup session on any frame close
The popup's q (cj/dirvish-popup-quit) reaps the session's dired buffers, but closing the Hyprland float directly or letting it lose focus bypasses q and orphans them, which is the "leaves a load of buffers around" symptom. A delete-frame-functions hook scoped to the "dirvish" popup frame runs dirvish-quit on every close path. Regular C-x d sessions, where multiple dired buffers are wanted for mark-and-move, and the global dired-kill-when-opening-new-dired-buffer (deliberately off for that same reason) are both untouched. Verified: a navigated popup session drops back to baseline when the frame closes without q.
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/dirvish-config.el | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/modules/dirvish-config.el b/modules/dirvish-config.el index c4c5f1aae..81d352dbd 100644 --- a/modules/dirvish-config.el +++ b/modules/dirvish-config.el @@ -486,6 +486,22 @@ leaves an empty frame behind." (when (frame-live-p popup) (delete-frame popup))) (dirvish-quit)))) +(defun cj/--dirvish-popup-reap-on-delete (frame) + "Quit the Dirvish session when the Super+F popup FRAME is closed any way. +`q' runs `cj/dirvish-popup-quit', but closing the Hyprland float directly (or +letting it lose focus) bypasses that and orphans the session's dired buffers -- +the \"leaves a load of buffers around\" symptom. As a `delete-frame-functions' +hook this fires on every close path; `dirvish-quit' reaps the session's buffers +(verified: a navigated session drops back to baseline on quit). Scoped to the +popup frame so ordinary `C-x d' sessions -- where multiple dired buffers are +wanted for mark-and-move -- are untouched." + (when (and (frame-live-p frame) + (equal (frame-parameter frame 'name) "dirvish")) + (with-selected-frame frame + (ignore-errors (dirvish-quit))))) + +(add-hook 'delete-frame-functions #'cj/--dirvish-popup-reap-on-delete) + (defun cj/--dirvish-popup-selected-p () "Return non-nil when the selected frame is the dirvish popup frame." (let ((popup (cj/--dirvish-popup-frame))) |
