Socialify

Folder ..

Viewing remote.js
45 lines (37 loc) • 993.0 B

 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
import { remote } from 'electron'
import { isWindows, platform } from '../main/application/helpers/os'

window.isWindows = () => {
  return isWindows()
}

window.platform = () => {
  return platform()
}

window.showSaveDialog = callback => {
  remote.dialog.showSaveDialog({ defaultPath: 'vault.pwmx' }).then(callback)
}

window.minimizeWindow = () => {
  const win = remote.getCurrentWindow()
  win.minimize()
}

window.maximizeWindow = () => {
  const win = remote.getCurrentWindow()
  win.maximize()
}

window.unmaximizeWindow = () => {
  const win = remote.getCurrentWindow()
  win.unmaximize()
}

window.closeWindow = () => {
  const win = remote.getCurrentWindow()
  win.close()
}

window.toggleMaxRestoreButtons = (maxButton, restoreButton) => {
  const win = remote.getCurrentWindow()
  if (win.isMaximized()) {
    maxButton.style.display = 'none'
    restoreButton.style.display = 'flex'
  } else {
    restoreButton.style.display = 'none'
    maxButton.style.display = 'flex'
  }
}