Socialify

Folder ..

Viewing index.js
34 lines (32 loc) • 965.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
import path from 'path'
import electron, { Menu, shell } from 'electron'
import trayIcon from '[email protected]'
import lightTrayIcon from '[email protected]'

export default class Tray extends electron.Tray {
  constructor(app) {
    const icon = process.platform === 'darwin' ? trayIcon : lightTrayIcon
    super(path.resolve(__dirname, icon))
    this.app = app
    this.setToolTip(CONFIG.name)
    this.setContextMenu(this.menu())
  }

  menu() {
    return Menu.buildFromTemplate([
      { label: 'Open Password Manager', click: () => this.app.window.show() },
      {
        label: 'Lock Password Manager Screen',
        click: () => this.app.showAuth()
      },
      { type: 'separator' },
      {
        label: 'Repository',
        click: () =>
          shell.openExternal(
            'https://github.com/BackSlash-Linux/password-manager'
          )
      },
      { type: 'separator' },
      { label: 'Quit', role: 'quit' }
    ])
  }
}