rendered paste body(defun switch-to (win)
(when (not (window-get win 'sticky))
(select-workspace (nearest-workspace-with-window win current-workspace))
(when (window-get win 'shaded)
(unshade-window win))
(show-window win)
(raise-window win)
; (warp-cursor-to-window win)
(set-input-focus win)))
(defun match-window-by-mode (regex mode ignorecase)
(remove-if-not #'(lambda (w)
(string-match regex
(or (cond
((equal mode "class") (window-class w))
((equal mode "title") (window-name w)))
"")
0 ignorecase))
(managed-windows)))
(defun run-or-raise (regex command #!optional (mode "class") (ignorecase nil))
(let ((win (car (match-window-by-mode regex mode ignorecase))))
(if win (switch-to win) (system command))))