Skip to content

Instantly share code, notes, and snippets.

@superdaigo
Created October 5, 2012 22:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save superdaigo/3842934 to your computer and use it in GitHub Desktop.
Save superdaigo/3842934 to your computer and use it in GitHub Desktop.
Klipper copy & paste for emacs terminal (KDE)
;; linux
(when (eq 'gnu/linux system-type)
;; terminal
(unless window-system
;; I don't know how to detect the system was KDE or not. :(
(defun copy-from-kde()
(let ((output (shell-command-to-string "qdbus org.kde.klipper /klipper getClipboardContents")))
(unless (string= (car kill-ring) output)
output )))
(defun paste-to-kde (text &optional push)
(let ((process-connection-type nil))
(let ((proc (start-process "proc" "*Messages*" "qdbus" "org.kde.klipper" "/klipper" "setClipboardContents" text)))
)))
(setq interprogram-cut-function 'paste-to-kde)
(setq interprogram-paste-function 'copy-from-kde)
)
)
;; Great Thanks
;; pbcopy & pbpaste for Emacs <https://gist.github.com/267162>
;; shell-helpers <https://github.com/milianw/shell-helpers/blob/master/clipboard>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment