node webkit - App window restore on keypress -



node webkit - App window restore on keypress -

in app have added functionality minimize app window scheme tray on keypress (on esc or pause/break buttons press). when pressing them window minimized.

is there way add together functionality restore app window on keypress (even if other application active)?

for illustration press pause , window minimized. press pause , app window restored.

here solution extracted node-webkit wiki :

// load native ui library. var gui = require('nw.gui'); var alternative = { key: "ctrl+shift+a", active: function() { console.log("global desktop keyboard shortcut: " + this.key + " active."); }, failed: function(msg) { // :(, fail register |key| or couldn't parse |key|. console.log(msg); } }; // create shortcut |option|. var shortcut = new gui.shortcut(option); // register global desktop shortcut, can work without focus. gui.app.registerglobalhotkey(shortcut); // if register |shortcut| , user struck "ctrl+shift+a", |shortcut| // "active" event. // can add together listener shortcut's active , failed event. shortcut.on('active', function() { console.log("global desktop keyboard shortcut: " + this.key + " active."); }); shortcut.on('failed', function(msg) { console.log(msg); }); // unregister global desktop shortcut. gui.app.unregisterglobalhotkey(shortcut);

this illustration show how create global shortcut listener , different way hear event. show how unregister shortcut.

node-webkit

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -