Files: 0818fbce083be238b301bb475711fa9ee88e69b0 / windowControls.js
832 bytesRaw
1 | const { h } = require('mutant') |
2 | const { remote } = require('electron') |
3 | const path = require('path') |
4 | |
5 | function windowControls () { |
6 | if (process.platform === 'darwin') return |
7 | |
8 | const window = remote.getCurrentWindow() |
9 | const minimize = () => window.minimize() |
10 | const maximize = () => { |
11 | if (!window.isMaximized()) window.maximize() |
12 | else window.unmaximize() |
13 | } |
14 | const close = () => window.close() |
15 | |
16 | return h('div.window-controls', [ |
17 | h('img.min', { |
18 | src: assetPath('minimize.png'), |
19 | 'ev-click': minimize |
20 | }), |
21 | h('img.max', { |
22 | src: assetPath('maximize.png'), |
23 | 'ev-click': maximize |
24 | }), |
25 | h('img.close', { |
26 | src: assetPath('close.png'), |
27 | 'ev-click': close |
28 | }) |
29 | ]) |
30 | } |
31 | |
32 | module.exports = windowControls |
33 | |
34 | function assetPath (name) { |
35 | return path.join(__dirname, 'assets', name) |
36 | } |
37 |
Built with git-ssb-web