brookhong / Surfingkeys

Map your keys for web surfing, expand your browser with javascript and keyboard.
https://chrome.google.com/webstore/detail/surfingkeys/gfbliohnnapiefjpjlpjnehglfpaknnc
MIT License
5.39k stars 478 forks source link

HOW TO MAP KEYS #1726

Closed huwqchn closed 2 years ago

huwqchn commented 2 years ago

my keyboard layout is colemak, so the default hotkeys doesn't suit me. I wrote my own config, but NOT WORK. this is my config,

api.mapkey("?", "Show usage", "Normal.showUsage()");

api.mapkey("e", "Scroll down", 'Normal.scroll("down")');
api.mapkey("u", "Scroll up", 'Normal.scroll("up")');
api.mapkey("n", "Scroll left", 'Normal.scroll("left")');
api.mapkey("i", "Scroll right", 'Normal.scroll("right")');
api.mapkey("N", "Go back in history", "history.go(-1)");
api.mapkey("I", "Go forward in history", "history.go(1)");

api.mapkey(
  "k",
  "Go to edit box",
  'Hints.create("input:visible, textarea:visible", Hints.dispatchMouseClick)'
);

what's wrong with my config. I tried it for long time, please help me.

clarkwang commented 2 years ago

Try like this:

api.mapkey("e", "Scroll down", () => { Normal.scroll("down"); });
huwqchn commented 2 years ago

it's worked ''' api.mapkey("e", "Scroll down", () => { Normal.scroll("down"); }); '''