diff --git a/bin/org-capture b/bin/org-capture index d52e84a50..86348c2d8 100755 --- a/bin/org-capture +++ b/bin/org-capture @@ -14,10 +14,10 @@ cleanup() { } # If emacs isn't running, we start a temporary daemon, solely for this window. -if ! emacsclient --suppress-output --eval nil; then +if ! emacsclient --suppress-output --eval nil 2>/dev/null; then + echo "No Emacs daemon/server is available! Starting one..." emacs --daemon trap cleanup EXIT INT TERM - daemon=1 fi # org-capture key mapped to argument flags @@ -37,13 +37,7 @@ esac # Fix incompatible terminals that cause odd 'not a valid terminal' errors [ "$TERM" = "alacritty" ] && export TERM=xterm-256color -if [ $daemon ]; then - emacsclient -a "" \ - -c -F '((name . "doom-capture") (width . 70) (height . 25) (transient . t))' \ - -e "(+org-capture/open-frame \"$str\" ${key:-nil})" -else - # Non-daemon servers flicker a lot if frames are created from terminal, so we - # do it internally instead. - emacsclient -a "" \ - -e "(+org-capture/open-frame \"$str\" ${key:-nil})" -fi +# Non-daemon servers flicker a lot if frames are created from terminal, so we do +# it internally instead. +emacsclient -a "" \ + -e "(+org-capture/open-frame \"$str\" ${key:-nil})" diff --git a/modules/lang/org/autoload/org-capture.el b/modules/lang/org/autoload/org-capture.el index 7ff91baea..c6b00a11a 100644 --- a/modules/lang/org/autoload/org-capture.el +++ b/modules/lang/org/autoload/org-capture.el @@ -15,8 +15,9 @@ (width . 70) (height . 25) (transient . t) - ,(when (and IS-LINUX (not (getenv "DISPLAY"))) - `(display . ":0")) + ,@(when IS-LINUX + `((window-system . ,(if (boundp 'pgtk-initialized) 'pgtk 'x)) + (display . ,(or (getenv "DISPLAY") ":0")))) ,(if IS-MAC '(menu-bar-lines . 1))) "TODO")