Re: [dev] surf patch: bind keystrokes to snippets of Javascript

From: Sean Whitton <sean_AT_silentflame.com>
Date: Tue, 11 May 2010 14:13:01 +0100

Hi,

On Tue, May 11, 2010 at 11:10:04AM +0200, Troels Henriksen wrote:
> The attached patch lets you bind keys to small lines of Javascript to
> run.
>
> The intent is that the usual ~/.surf/script.js defines various methods,
> which are then run by the bindings. This is much cleaner than having
> script.js create its own event listeners for keybindings going outside
> surf's own system.

This works brilliantly - thank you. If anyone was wondering how to add
keybindings to your config file, this is what I have in config.h for
hinting (that works):

{ 0, GDK_f, eval, { .v = (char *[]){ "hintMode()", NULL } } },
{ 0, GDK_F, eval, { .v = (char *[]){ "hintMode(true)", NULL } } },
{ 0, GDK_Escape, eval, { .v = (char *[]){ "removeHints()", NULL } } },

... and just comment out the line document.addEventListener all the way
down to the end of the hinting script in script.js.

S

-- 
Sean Whitton / <sean_AT_silentflame.com>
OpenPGP KeyID: 0x3B6D411B
http://seanwhitton.com/

Received on Tue May 11 2010 - 13:13:01 UTC

This archive was generated by hypermail 2.2.0 : Tue May 11 2010 - 15:36:01 UTC