diff --git a/config/stumpwm/config.lisp b/config/stumpwm/config.lisp index bdcc55f..dd1dcd4 100644 --- a/config/stumpwm/config.lisp +++ b/config/stumpwm/config.lisp @@ -340,13 +340,16 @@ If PERSISTENT is t, smart-kill will hide the window instead of killing it." ;; returns to wherever you came from. We track the previous group ourselves ;; rather than relying on gother, which is unreliable when windows spawn async. -(defun toggle-scratchpad-group (group-name command &key window-title) +(defun toggle-scratchpad-group (group-name command &key window-class window-title) (let* ((screen (current-screen)) (current (current-group)) (target (find-group screen group-name)) - (existing (when window-title - (find-if (lambda (w) (string= (window-name w) window-title)) - (screen-windows screen))))) + (existing (or (when window-class + (find-if (lambda (w) (string= (window-class w) window-class)) + (screen-windows screen))) + (when window-title + (find-if (lambda (w) (string= (window-name w) window-title)) + (screen-windows screen)))))) (if (eq current target) (when *scratchpad-previous-group* (switch-to-group *scratchpad-previous-group*)) @@ -366,12 +369,14 @@ If PERSISTENT is t, smart-kill will hide the window instead of killing it." (defcommand scratch-term-1 () () "Toggle fullscreen persistent terminal (wezterm)." (toggle-scratchpad-group "scratch-term-1" - "wezterm start --class scratch-term-1")) + "wezterm start --class scratch-term-1" + :window-class "scratch-term-1")) (defcommand scratch-term-2 () () "Toggle second fullscreen persistent terminal (wezterm)." (toggle-scratchpad-group "scratch-term-2" - "wezterm start --class scratch-term-2")) + "wezterm start --class scratch-term-2" + :window-class "scratch-term-2")) (defcommand scratch-emacs-1 () () "Toggle fullscreen persistent emacsclient frame."