Node-Webkit Ctrl-加号和 Ctrl-减号

Node-Webkit Ctrl-plus and Ctrl-minus

如何让 node-webkit (NW) 接受 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);

我不得不做类似的事情并最终使用 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; 
});