-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathmain.js
More file actions
34 lines (28 loc) · 773 Bytes
/
main.js
File metadata and controls
34 lines (28 loc) · 773 Bytes
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
var app = require('app')
var BrowserWindow = require('browser-window')
var Tray = require('tray')
var nativeImage = require('native-image')
var mainWindow = null
app.on('ready', function () {
mainWindow = new BrowserWindow({
'width': 700,
'height': 400,
'frame': false,
'show': false,
'skip-taskbar': false
})
mainWindow.loadUrl('file://' + __dirname + '/repl.html')
mainWindow.on('blur', function () {
mainWindow.hide()
})
var trayIcon = new Tray(nativeImage.createFromPath(__dirname + '/icon.png'))
trayIcon.setToolTip(app.getName())
trayIcon.on('clicked', function (e, b) {
mainWindow.setPosition(b.x - 350, 0)
if (mainWindow.isVisible()) {
mainWindow.hide()
} else {
mainWindow.show()
}
})
})