Surfingkeys icon indicating copy to clipboard operation
Surfingkeys copied to clipboard

How to create a command to execute Javascript?

Open vnikk opened this issue 2 years ago • 2 comments

Hi. First of all, thanks for a great tool! I absolutely love it! Is there a way to create a command which will execute some Javascript? I want to do: map(';ggl', 'window.location.replace('https://www.google.com'); But this just executes google.com when settings are loaded and every tab goes there.

vnikk avatar Feb 11 '22 18:02 vnikk

You can use mapkey

// Bind to g H
api.mapkey('gH', 'Say Hi', function() {
    //Your code
    alert("Hi");
});

API is here

eugercek avatar Feb 12 '22 16:02 eugercek

Many examples could be found at https://github.com/brookhong/Surfingkeys/blob/master/src/content_scripts/common/default.js

cibinmathew avatar Feb 13 '22 07:02 cibinmathew