[Sawfish] Paste selection to window from lisp

[ Thread Index | Date Index | More lists.tuxfamily.org/sawfish Archives ]


Hi,

I wrote a little function that lets me paste the contents of the X11
selection to the currently focused window.  I have it working using
the "xdotool" program to perform the paste.  The xdotool "types" the
selection kind of slowly and I'd rather not rely on an external
program.  Is there a rep/sawfish function I can use to perform the
paste.  My searches for one came up empty.  Or, is there maybe a
better way to do this?

Here is the function.

(provide 'bv-paste)
(defun xpasteto (w)
  "Paste current selection into current window"
  (interactive "%f")
  (require 'selection)
  (let ((selection  (x-get-selection 'PRIMARY)))
    (let ((cmd (format nil "xdotool type --window %d \"%s\""
(window-id w) selection)))
      (system cmd))))
(bind-keys global-keymap "C-M-SPC" xpasteto)

-Brett.

-- 
Sawfish ML


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/