Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Pasting the X selection at the text cursor

0 views
Skip to first unread message

phil.g...@gmail.com

unread,
Dec 31, 2009, 4:51:22 AM12/31/09
to
Is it possible to write a program to paste the X selection at the text
cursor in the window that has focus when the program is invoked? Or
where would be the best place to ask this?

I found a simple script that uses Wish, but it only pastes the
selection in the terminal window where the script was invoked (if
there is one):

#! /bin/sh
exec wish "$0" "$@"
set buffer ""
catch {set buffer [selection get]}
puts $buffer
exit

Stephane CHAZELAS

unread,
Dec 31, 2009, 6:06:55 AM12/31/09
to
2009-12-31, 01:51(-08), p...@gmail.com:

> Is it possible to write a program to paste the X selection at the text
> cursor in the window that has focus when the program is invoked? Or
> where would be the best place to ask this?
[...]

"pasting the selection" not always makes sense for a "window".

What you could do is use xte to simulate a <Ctrl-V> or
<Shift-Insert> or <Middle-button>.

xdpyinfo can tell you the window id of the window that has the
focus. xwininfo -all and xprop can tell you more on that window
(like its class or name or the list of events it expects so you
can decide what key combination to use).

--
Stᅵphane

mop2

unread,
Dec 31, 2009, 3:49:26 PM12/31/09
to
On Thu, 31 Dec 2009 07:51:22 -0200, p...@gmail.com <phil.g...@gmail.com> wrote:

> Is it possible to write a program to paste the X selection at the text
> cursor in the window that has focus when the program is invoked? Or

http://sourceforge.net/projects/xclip/

0 new messages