Fix emacs ephemeral window in stumpwm

This commit is contained in:
Ian Keane 2026-09-05 20:18:46 -04:00
parent e6ff121cc7
commit 20bcc0d97f

View file

@ -494,7 +494,15 @@ If PERSISTENT is t, smart-kill will hide the window instead of killing it."
(let* ((screen (current-screen)) (let* ((screen (current-screen))
(current (current-group)) (current (current-group))
(target (find-group screen group-name)) (target (find-group screen group-name))
(existing (or (when window-class ;; Once a scratchpad window has been created, it stays resident in
;; its own dedicated group even after we switch away from it. So the
;; most reliable "does it already exist" check is simply: does the
;; target group already have a window in it? This avoids relying on
;; window title, which for programs like Emacs changes constantly
;; based on the current buffer and would otherwise cause a fresh
;; instance to be spawned every time.
(existing (or (first (group-windows target))
(when window-class
(find-if (lambda (w) (string= (window-class w) window-class)) (find-if (lambda (w) (string= (window-class w) window-class))
(screen-windows screen))) (screen-windows screen)))
(when window-title (when window-title