git ssb

2+

mixmix / ticktack



Tree: 0f3f8657225d9eb6e00c551660cc3a05e760c3bd

Files: 0f3f8657225d9eb6e00c551660cc3a05e760c3bd / windowControls.js

832 bytesRaw
1const { h } = require('mutant')
2const { remote } = require('electron')
3const path = require('path')
4
5function 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
32module.exports = windowControls
33
34function assetPath (name) {
35 return path.join(__dirname, 'assets', name)
36}
37

Built with git-ssb-web