-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
contextmenu.js
99 lines (94 loc) · 2.03 KB
/
contextmenu.js
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
88
89
90
91
92
93
94
95
96
97
98
99
const { app, Menu, shell } = require('electron');
const config = require('./config.js');
const package_json = require('./package.json');
const VERSION = package_json.version;
function buildContextMenu() {
let contextMenu = Menu.buildFromTemplate([
{
label: 'midi-relay: v' + VERSION,
enabled: false
},
{
label: 'API running on port: ' + config.get('apiPort'),
enabled: false
},
{
label: 'MIDI Input Ports Detected: ' + global.MIDI_INPUTS.length,
enabled: false
},
{
label: 'MIDI Output Ports Detected: ' + global.MIDI_OUTPUTS.length,
enabled: false
},
{
label: 'Rescan for MIDI Ports',
click: function () {
global.refreshPorts();
}
},
{
label: 'Periodically Rescan for MIDI Ports',
type: 'checkbox',
checked: config.get('allowRescan'),
click: function () {
config.set('allowRescan', !config.get('allowRescan'));
global.startRescanInterval();
}
},
{
type: 'separator'
},
{
label: 'Allow MIDI Remote Control',
type: 'checkbox',
checked: config.get('allowControl'),
click: function () {
config.set('allowControl', !config.get('allowControl'));
global.sendControlStatus();
}
},
{
label: 'Show Notifications',
type: 'checkbox',
checked: config.get('allowNotifications'),
click: function () {
config.set('allowNotifications', !config.get('allowNotifications'));
}
},
{
type: 'separator'
},
{
label: 'Show License on Startup',
type: 'checkbox',
checked: config.get('showLicense'),
click: function () {
config.set('showLicense', !config.get('showLicense'));
}
},
{
label: 'Open MIDI Input Trigger Settings',
click: function() {
shell.openExternal(`http://127.0.0.1:${config.get('apiPort')}`)
}
},
{
label: 'Request Help/Support',
click: function() {
shell.openExternal(config.get('supportUrl'))
}
},
{
label: 'Quit',
click: function () {
app.quit();
}
}
]);
tray.setContextMenu(contextMenu);
}
module.exports = {
buildContextMenu() {
buildContextMenu();
}
}