-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
46 lines (39 loc) · 1.19 KB
/
main.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
'use strict'
const app = require('app')
const BrowserWindow = require('browser-window')
const globalShortcut = require('global-shortcut')
// Report crashes to our server.
require('crash-reporter').start()
// Quit when all windows are closed.
app.on('window-all-closed', function() {
// On OS X it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit()
}
})
let mainWindow = null
app.on('ready', function() {
// Create the browser window.
mainWindow = new BrowserWindow({
width: 1200
, height: 800
})
// Load the index.html of the app.
mainWindow.loadUrl(`file://${__dirname}/index.html`)
globalShortcut.register('MediaPlayPause', function() {
ipc.send('togglePlay')
})
globalShortcut.register('MediaStop', function() {
ipc.send('stop')
})
globalShortcut.register('MediaNextTrack', function() {
ipc.send('nextTrack')
})
globalShortcut.register('MediaPreviousTrack', function() {
ipc.send('previousTrack')
})
mainWindow.on('closed', function() {
mainWindow = null
})
})