Re: Paste selection to window from lisp

Christopher Roy Bratusek <[email protected]> Mon, 01 Sep 2014 18:27:11 +0200
Newsgroups gmane.comp.window-managers.sawfish
Message-ID <[email protected]>
There's no such function in Sawfish.

On 31.08.2014 21:31, Brett Viren wrote:
> 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