librelist archives

« back to archive

Fallthrough with customizations

Fallthrough with customizations

From:
Tim Ramsey
Date:
2014-04-15 @ 17:09
Hello everyone.

I would like to do a relatively simple thing.  I have spent a while looking
for an answer, but have not managed to hit the magic search terms to reveal
it.

A number of websites define shortcut keys (e.g. gmail, github). If you want
to use those shortcuts it is a simple matter of putting $fallthrough in the
appropriate mode map for the site.  What I would like to do is execute a
bit of code before (or after) the keystroke falls through to the site.

Alternatively (and more simply put), how do I send a keystroke to the
underlying page from a conkeror interactive command?

Thanks,
-Tim Ramsey

Re: [conkeror] Fallthrough with customizations

From:
John J. Foerch
Date:
2014-04-21 @ 22:04
On Tue, Apr 15, 2014 at 01:09:59PM -0400, Tim Ramsey wrote:
> Hello everyone. 
> 
> I would like to do a relatively simple thing.  I have spent a while looking for
> an answer, but have not managed to hit the magic search terms to reveal it.
> 
> A number of websites define shortcut keys (e.g. gmail, github). If you want to
> use those shortcuts it is a simple matter of putting $fallthrough in the
> appropriate mode map for the site.  What I would like to do is execute a bit of
> code before (or after) the keystroke falls through to the site. 
> 

You don't quite have it right, and you're getting into a problematic area
for Conkeror.  Sad but true, Conkeror's input system has problems playing
nice with some websites.  The key idea is that there are three different
events associated with each keystroke: keydown, keypress, keyup.
Conkeror's input system only know about keypress, and our efforts to make
it handle keydown and keyup nicely have all met with failure, so far.
Unfortunately, more and more websites are putting keyboard handlers on
keydown.  What happens when you press a key that a website handles on
keydown varies with the version of xulrunner.

In older versions of xulrunner (< 25 or so): the website's keydown handler
*and* conkeror's keypress handler both run.  "$fallthrough" keybindings in
Conkeror suppress Conkeror's handling, so it is at least easy to tell
Conkeror to get out of the way.  If you want Conkeror to do something in
addition to what the website does, just make an ordinary keybinding.  Both
run.  If you want to suppress the website's handling of keydown or keyup
events, the best way was key-kill-mode (look it up on the wiki), but after
about xulrunner 25 or so, this method broke.

From some recent version of xulrunner (25 or 26?), if a website handles
keydown, and kills the keydown event from further processing, it also
prevents keypress handlers from running, which means that in recent
versions of xulrunner, websites can completely override Conkeror.  It's a
horrible situation.

> Alternatively (and more simply put), how do I send a keystroke to the
> underlying page from a conkeror interactive command?
> 
> Thanks,
> -Tim Ramsey

You can synthesize keyboard events.  See Conkeror's send_key_as_event for
an example.  Another approach is to call into the website's javascript.
Duckduckgo-mode uses this technique.

Hope this helps.

-- 
John Foerch

Re: [conkeror] Fallthrough with customizations

From:
Tim Ramsey
Date:
2014-04-23 @ 14:47
John,

This helps very much.  Thanks for taking the time to explain.

-Tim Ramsey


On Mon, Apr 21, 2014 at 6:04 PM, John J. Foerch <jjfoerch@earthlink.net>wrote:

> On Tue, Apr 15, 2014 at 01:09:59PM -0400, Tim Ramsey wrote:
> > Hello everyone.
> >
> > I would like to do a relatively simple thing.  I have spent a while
> looking for
> > an answer, but have not managed to hit the magic search terms to reveal
> it.
> >
> > A number of websites define shortcut keys (e.g. gmail, github). If you
> want to
> > use those shortcuts it is a simple matter of putting $fallthrough in the
> > appropriate mode map for the site.  What I would like to do is execute a
> bit of
> > code before (or after) the keystroke falls through to the site.
> >
>
> You don't quite have it right, and you're getting into a problematic area
> for Conkeror.  Sad but true, Conkeror's input system has problems playing
> nice with some websites.  The key idea is that there are three different
> events associated with each keystroke: keydown, keypress, keyup.
> Conkeror's input system only know about keypress, and our efforts to make
> it handle keydown and keyup nicely have all met with failure, so far.
> Unfortunately, more and more websites are putting keyboard handlers on
> keydown.  What happens when you press a key that a website handles on
> keydown varies with the version of xulrunner.
>
> In older versions of xulrunner (< 25 or so): the website's keydown handler
> *and* conkeror's keypress handler both run.  "$fallthrough" keybindings in
> Conkeror suppress Conkeror's handling, so it is at least easy to tell
> Conkeror to get out of the way.  If you want Conkeror to do something in
> addition to what the website does, just make an ordinary keybinding.  Both
> run.  If you want to suppress the website's handling of keydown or keyup
> events, the best way was key-kill-mode (look it up on the wiki), but after
> about xulrunner 25 or so, this method broke.
>
> >From some recent version of xulrunner (25 or 26?), if a website handles
> keydown, and kills the keydown event from further processing, it also
> prevents keypress handlers from running, which means that in recent
> versions of xulrunner, websites can completely override Conkeror.  It's a
> horrible situation.
>
> > Alternatively (and more simply put), how do I send a keystroke to the
> > underlying page from a conkeror interactive command?
> >
> > Thanks,
> > -Tim Ramsey
>
> You can synthesize keyboard events.  See Conkeror's send_key_as_event for
> an example.  Another approach is to call into the website's javascript.
> Duckduckgo-mode uses this technique.
>
> Hope this helps.
>
> --
> John Foerch
>

Re: [conkeror] Fallthrough with customizations

From:
Kinley Dorji
Date:
2014-04-24 @ 03:29
Yes, thanks for that explanation John. The only place where this problem
has hit me so far (that I've noticed) is on Github.


On Wed, Apr 23, 2014 at 8:47 PM, Tim Ramsey <tramsey@gmail.com> wrote:

> John,
>
> This helps very much.  Thanks for taking the time to explain.
>
> -Tim Ramsey
>
>
> On Mon, Apr 21, 2014 at 6:04 PM, John J. Foerch <jjfoerch@earthlink.net>wrote:
>
>> On Tue, Apr 15, 2014 at 01:09:59PM -0400, Tim Ramsey wrote:
>> > Hello everyone.
>> >
>> > I would like to do a relatively simple thing.  I have spent a while
>> looking for
>> > an answer, but have not managed to hit the magic search terms to reveal
>> it.
>> >
>> > A number of websites define shortcut keys (e.g. gmail, github). If you
>> want to
>> > use those shortcuts it is a simple matter of putting $fallthrough in the
>> > appropriate mode map for the site.  What I would like to do is execute
>> a bit of
>> > code before (or after) the keystroke falls through to the site.
>> >
>>
>> You don't quite have it right, and you're getting into a problematic area
>> for Conkeror.  Sad but true, Conkeror's input system has problems playing
>> nice with some websites.  The key idea is that there are three different
>> events associated with each keystroke: keydown, keypress, keyup.
>> Conkeror's input system only know about keypress, and our efforts to make
>> it handle keydown and keyup nicely have all met with failure, so far.
>> Unfortunately, more and more websites are putting keyboard handlers on
>> keydown.  What happens when you press a key that a website handles on
>> keydown varies with the version of xulrunner.
>>
>> In older versions of xulrunner (< 25 or so): the website's keydown handler
>> *and* conkeror's keypress handler both run.  "$fallthrough" keybindings in
>> Conkeror suppress Conkeror's handling, so it is at least easy to tell
>> Conkeror to get out of the way.  If you want Conkeror to do something in
>> addition to what the website does, just make an ordinary keybinding.  Both
>> run.  If you want to suppress the website's handling of keydown or keyup
>> events, the best way was key-kill-mode (look it up on the wiki), but after
>> about xulrunner 25 or so, this method broke.
>>
>> >From some recent version of xulrunner (25 or 26?), if a website handles
>> keydown, and kills the keydown event from further processing, it also
>> prevents keypress handlers from running, which means that in recent
>> versions of xulrunner, websites can completely override Conkeror.  It's a
>> horrible situation.
>>
>> > Alternatively (and more simply put), how do I send a keystroke to the
>> > underlying page from a conkeror interactive command?
>> >
>> > Thanks,
>> > -Tim Ramsey
>>
>> You can synthesize keyboard events.  See Conkeror's send_key_as_event for
>> an example.  Another approach is to call into the website's javascript.
>> Duckduckgo-mode uses this technique.
>>
>> Hope this helps.
>>
>> --
>> John Foerch
>>
>
>