2016-09-10 7 views
2

Electronを使用してOSXアプリケーションを作成しています( )、主にトレイにフォーカスしています。基本的には、アプリケーションが現在使用されているときのみ表示されます。ウィンドウに依存しないように設定するにはどうすればよいですか?[Electron] [OSX]トレイアイコンを常に表示

答えて

2

メインプロセスでトレイを作成するだけで、ウィンドウを作成することはできません。

const {app, Menu, Tray} = require('electron') 

let tray = null 
app.on('ready',() => { 
    tray = new Tray('/path/to/my/icon') 
    const contextMenu = Menu.buildFromTemplate([ 
    {label: 'Item1', type: 'radio'}, 
    {label: 'Item2', type: 'radio'}, 
    {label: 'Item3', type: 'radio', checked: true}, 
    {label: 'Item4', type: 'radio'} 
    ]) 
    tray.setToolTip('This is my application.') 
    tray.setContextMenu(contextMenu) 
}) 
関連する問題