diff --git a/config/stumpwm/config.lisp b/config/stumpwm/config.lisp index f4eca9d..71706fc 100644 --- a/config/stumpwm/config.lisp +++ b/config/stumpwm/config.lisp @@ -494,7 +494,15 @@ If PERSISTENT is t, smart-kill will hide the window instead of killing it." (let* ((screen (current-screen)) (current (current-group)) (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)) (screen-windows screen))) (when window-title