-
Notifications
You must be signed in to change notification settings - Fork 0
/
loader.html
87 lines (76 loc) · 1.99 KB
/
loader.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<script>
var active = false;
var new_win;
// Load native UI library.
var gui = require('nw.gui');
// Get the current window
var win = gui.Window.get();
var option = {
key : "Alt+Shift+A",
active : function() {
// New window options
var new_win_option = {
"title": "IAM",
"toolbar": false,
"frame": false,
"always-on-top": true,
"transparent": true,
"no-edit-menu": true,
"single-instance": true,
"show": true,
"node-remote": "*",
"width": 800,
"height": 500,
"position": "center",
"min_width": 400,
"min_height": 200,
"max_width": 800,
"max_height": 600
};
if (new_win) {
new_win.close();
new_win = false;
} else {
new_win = gui.Window.open('/index.html', new_win_option);
new_win.on('loaded', function () {
// new_win.show();
new_win.focus();
});
}
// And listen to new window's blur event
// new_win.on('blur', function() {
// new_win.close();
// });
// focused = !focused;
// if (focused) {
// win.show();
// win.focus();
// } else {
// win.blur();
// win.hide();
// }
},
failed : function(msg) {
console.log(msg);
}
};
win.hide();
win.blur();
// Create a shortcut with |option|.
var shortcut = new gui.Shortcut(option);
// Register global desktop shortcut, which can work without focus.
gui.App.registerGlobalHotKey(shortcut);
// You can also add listener to shortcut's active and failed event.
// shortcut.on('active', function() {
// win.show();
// win.focus();
// console.log("Global desktop keyboard shortcut: " + this.key + " active.");
// });
//
// shortcut.on('failed', function(msg) {
// console.log(msg);
// });
win.blur();
// Unregister the global desktop shortcut.
// gui.App.unregisterGlobalHotKey(shortcut);
</script>