This repository has been archived by the owner on Jun 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move service of tray control to separate module
- Loading branch information
1 parent
84f2444
commit 8135478
Showing
3 changed files
with
49 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/** | ||
* Module for Tray functions. | ||
*/ | ||
|
||
const {Tray} = require('electron') | ||
|
||
let trayServiceWindow = null | ||
let tray = null | ||
|
||
let trayService = {} | ||
|
||
trayService.initTray = (window) => { | ||
trayServiceWindow = window | ||
let iconPath = __dirname + '/../images/icon.png' | ||
tray = new Tray(iconPath) | ||
tray.setToolTip('Chimeverse') | ||
|
||
tray.on('click', function() { | ||
trayService.hideEnvelope() | ||
trayServiceWindow.show() | ||
}) | ||
} | ||
|
||
trayService.showEnvelope = () => { | ||
tray.setImage(__dirname + '/../images/envelope.png') | ||
} | ||
|
||
trayService.hideEnvelope = () => { | ||
tray.setImage(__dirname + '/../images/icon.png') | ||
} | ||
|
||
module.exports = trayService | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters