FVWM: how to? FakeClick for Middle button

2013-01-25 Thread Spoofing
sup.

I like to use Shift + Insert for paste text from clipboard everywhere,
and for example, when I run Firefox, want to press Shift + Insert for
open URL from clipboard, like the mouse middle (button 2) click.

Key Insert A S FakeClick depth 2 press 2 wait 250 release 2

doesn't work, and also try to change depth, but nothing happens...

how to simulate mouse middle click button with Shift + Insert? :)



Re: FVWM: how to? FakeClick for Middle button

2013-01-25 Thread Jaimos F Skriletz

On 01/25/2013 08:23 AM, Spoofing wrote:

sup.

I like to use Shift + Insert for paste text from clipboard everywhere,
and for example, when I run Firefox, want to press Shift + Insert for
open URL from clipboard, like the mouse middle (button 2) click.

 Key Insert A S FakeClick depth 2 press 2 wait 250 release 2

doesn't work, and also try to change depth, but nothing happens...

how to simulate mouse middle click button with Shift + Insert? :)

First, not all applications like fake (or synthetic) events, and as per 
the man page FakeClick and FakeKeyPress are for debugging fvwm and not 
going to work in all situations. So your approach should be rethought.


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.


On the other hand firefox and many applications honor the ctrl-V paste 
button. In my testing I got


FakeKeyPress depth 2 modifiers 8 press v

To work just fine and correctly paste something into chromium (provided 
I copied with ctrl-C from an application first).


So that may work for you, but now you need to get a clipboard manager to 
keep the clipboard and cutbuffer in sync. It looks like something like 
'autocutsel' may do that for you. Though it could be possible that there 
are more advanced clibboard managers and you could use one of those to 
not only keep the two methods of copying/pasting in sync can probably 
set up custom key bindings to send the clibboard to the desired window. 
This is the direction I would look. It looks like clipit may have that 
functionality.


Using FakeKeyPress to make shift-insert work like ctrl-V will only work 
for applications which already honor ctrl-V so you are just changing the 
default. It will have no effect (or even other effects) because each 
application will honor the ctrl-V how ever it deems is correct. So even 
though that works in some applications it may not do what you want.


So I think getting a clipboard manager that has the feature to set up a 
keybinding would be the direction to go (note I have never messed with 
them, so I am unsure what sort of things the clipboard managers can do).


jaimos



Re: FVWM: how to? FakeClick for Middle button

2013-01-25 Thread Chris Siebenmann
| 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).

- cks
[*: actually it doesn't even get a click event; it gets a button-down
and then a button-up event in very close succession. Interested
parties can use 'xev' to see exactly what event streams the X server
sends in various circumstances.
]



Re: FVWM: how to? FakeClick for Middle button

2013-01-25 Thread Jaimos Skriletz
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