Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
(defun get-window-by-class (class)
"Return a window with the given class."
(first (filter-windows #'(lambda (w) (equal (window-class w) class)))))
(defun gimme (cmdline class)
"If a window matching CLASS is found switch to it, else launch cmdline."
(if class
(let ((wnd (get-window-by-class class)))
(if wnd
(display-window wnd)
(system cmdline)))
(system cmdline)))
(defun gimme-emacs ()
(gimme "emacs &" "Emacs"))
(bind-keys global-keymap "W-e" gimme-emacs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.