Re: [Sawfish] Paste selection to window from lisp

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


Hi Brett,

On Sun, 31 Aug 2014 15:31:50 -0400 Brett Viren <brett.viren@xxxxxxxxx> wrote:

> 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)

I use something similar in
http://parenteses.org/mario/utils/sawfish-extra-menus#selection-menu

Best wishes.
Mario
-- 
http://parenteses.org/mario

-- 
Sawfish ML


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