diff --git a/core/core-os.el b/core/core-os.el index ff024fd6f..2f5046bbd 100644 --- a/core/core-os.el +++ b/core/core-os.el @@ -7,6 +7,13 @@ (unless IS-MAC (setq command-line-ns-option-alist nil)) (unless IS-LINUX (setq command-line-x-option-alist nil)) +;; Fix the clipboard in terminal or daemon Emacs (non-GUI) +(defun doom|init-clipboard-in-tty-emacs () + (if IS-MAC + (if (require 'osx-clipboard nil t) (osx-clipboard-mode)) + (if (require 'xclip nil t) (xclip-mode)))) +(add-hook 'tty-setup-hook #'doom|init-clipboard-in-tty-emacs) + ;; stop copying each visual state move to the clipboard: ;; https://bitbucket.org/lyro/evil/issue/336/osx-visual-state-copies-the-region-on ;; grokked from: http://stackoverflow.com/questions/15873346/elisp-rename-macro @@ -30,10 +37,6 @@ ;; than a new one ns-pop-up-frames nil) - ;; Fix the clipboard in terminal or daemon Emacs (non-GUI) - (when (or (daemonp) (not (display-graphic-p))) - (add-hook 'doom-init-modules-hook #'osx-clipboard-mode)) - (when (or (daemonp) (display-graphic-p)) ;; Syncs ns frame parameters with theme (and fixes mismatching text ;; colr in the frame title) diff --git a/core/packages.el b/core/packages.el index fc86a5347..d2f34a5ee 100644 --- a/core/packages.el +++ b/core/packages.el @@ -2,6 +2,7 @@ ;;; core/packages.el ;; core-os.el +(package! xclip) (when IS-MAC (package! exec-path-from-shell) (package! osx-clipboard)