2015-12-17 2 views
1

Как сделать узел-WebKit (NW) принимает Ctrl ++ и Ctrl + - как ярлыки? Я пробовал:Node-Webkit Ctrl-плюс и Ctrl-минус

Ctrl++ 
Ctrl+Plus 
Ctrl+Plus 
Ctrl+Minus 
Ctrl+- 
Ctrl+minus 

, но он не работает. Каждый раз, когда он дает сообщение об ошибке.

Вот мой текущий код:

var option = { 
    key : "Ctrl+plus", 
    active : function() { 
    console.log("Global desktop keyboard shortcut: " + this.key + " active."); 
    }, 
    failed : function(msg) { 
    console.log(msg); 
    } 
    };enter code here 

    var shortcut = new nw.Shortcut(option); 

    nw.App.registerGlobalHotKey(shortcut); 

ответ

1

я должен был сделать что-то подобное и в конечном итоге с помощью JS:

$(window).keypress(function(event) { 
    if (!(event.which == 61)) return true; 
    # 61 is ctrl + plus on Mac, probably different on windows 
    alert("Ctrl-plus pressed"); 
    event.preventDefault(); 
    return false; 
}); 
Смежные вопросы