On Fri, Jan 25, 2013 at 01:09:16PM -0500, Chris Siebenmann wrote:
> | Second it is not firefox that 'pastes' when you click the middle mouse
> | button. It is xorg that intercepts the middle mouse click and then
> | sends the resulting paste to the window. So sending the middle mouse
> | button click to the root window or the firefox window (or any other
> | window) will note generate the paste event. Firefox does not know to
> | paste when it receives a middle mouse click.
> 
>  This portion is not correct. Neither the X server nor the window
> manager intercept middle mouse clicks and turn them into magic paste
> events (or into streams of characters). Pasting is entirely handled
> by the program involved and Firefox really does receive a middle
> mouse button click event[*] and then invoke its own code to paste
> stuff. Programs can and do do entirely different things in response to
> middle mouse buttons (for example, I am writing this email in a program
> that does something different with it).

Thanks for the clarification. My experience was all xprograms accept middle 
click and with using gvim (or vim in a terminal) that it just accepts it as a 
string of data being sent directally to the program, so I thought this was an 
xorg mechnisim as opposed to implemented on a program per program basis. Then 
the issue for me then must be chromium didn't like synthetic mouse events (just 
ignores it) but would work with a FakeKeyPress.

Back to the question of creating a nice paste key binding I have found the 
following. Most likely a clipboard manager will do what you want and you should 
look into that (As I suggested earlier) but if you really want to do this with 
fvwm you could try the following.

First xorg has three buffers, primary, secondary and clipboard. The primary 
gets used in the select/middle mouse paste, while the clipboard gets used by 
some programs with ctrl-c/ctrl-v is the standard. So depending on which buffer 
you want to paste from adjust the following.

Second, there is a tool called xsel which will give you the output of any of 
the three buffers (with primary being the default). You can use this program in 
conjecution with xdotool or xvkdb (send typing events to a window) and could 
paste the output of say the primary buffer to a paticular window with the 
command

xdotool type $(xsel)

So set that up as your key binding and it will send the output the the 
currently focused program. I would add some logic (or do selective key 
bindings) so you don't send the output to a program that wouldn't know what to 
do with the stream of keypresses. This doesn't seem as nice as telling the 
program itself to get the data from the correct buffer, but is a hack if you 
just want to send the buffer to the program and hope for the best.


jaimos



Reply via email to