Skip to content

Instantly share code, notes, and snippets.

@winny-
Created September 6, 2018 19:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save winny-/dfa59bec54ce8e6fa74efbfb4986cbe4 to your computer and use it in GitHub Desktop.
Save winny-/dfa59bec54ce8e6fa74efbfb4986cbe4 to your computer and use it in GitHub Desktop.
(defun winny/raise-or-create-window-system-frame (display)
"Raise an existing frame in the window system or create a new one."
(let ((frames (seq-filter #'(lambda (f) (frame-parameter f 'display)) (frame-list))))
(if (null frames)
(make-frame `((window-system . x)
(display . ,display)))
(select-frame-set-input-focus (car frames)))))
#!/bin/sh
set -eu
emacsclient -n -e "$(printf -- '(winny/raise-or-create-window-system-frame "%s")' "$DISPLAY")"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment