mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-07-30 11:10:04 +00:00
remove tray icon when process is shutdown
This commit is contained in:
parent
50a9993eb2
commit
5e8fdf724a
3 changed files with 14 additions and 4 deletions
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
|
@ -1,7 +1,7 @@
|
|||
const JiraApi = require('jira').JiraApi;
|
||||
|
||||
module.exports = (mainWindow, request) => {
|
||||
console.log(request);
|
||||
//console.log(request);
|
||||
|
||||
let config = request.config;
|
||||
let apiMethod = request.apiMethod;
|
||||
|
|
@ -12,7 +12,7 @@ module.exports = (mainWindow, request) => {
|
|||
let jira = new JiraApi('https', config.host, config.port, config.userName, config.password, 'latest');
|
||||
|
||||
jira[apiMethod](...arguments, (error, res) => {
|
||||
console.log('JIRA_RESPONSE', error, res);
|
||||
//console.log('JIRA_RESPONSE', error, res);
|
||||
|
||||
mainWindow.webContents.send('JIRA_RESPONSE', {
|
||||
error: error,
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ const powerSaveBlocker = require('electron').powerSaveBlocker;
|
|||
const moment = require('moment');
|
||||
const open = require('open');
|
||||
const CONFIG = require('./CONFIG');
|
||||
const IMAGE_FOLDER = __dirname + '/assets/img/';
|
||||
const ICONS_FOLDER = __dirname + '/assets/icons/';
|
||||
|
||||
const idle = require('./idle');
|
||||
const jira = require('./jira');
|
||||
|
|
@ -77,7 +77,7 @@ app.on('window-all-closed', function () {
|
|||
|
||||
let appIcon = null;
|
||||
app.on('ready', () => {
|
||||
appIcon = new electron.Tray(IMAGE_FOLDER + 'ico.png');
|
||||
appIcon = new electron.Tray(ICONS_FOLDER + 'tray-ico.png');
|
||||
let contextMenu = electron.Menu.buildFromTemplate([
|
||||
{
|
||||
label: 'Show App', click: () => {
|
||||
|
|
@ -92,6 +92,12 @@ app.on('ready', () => {
|
|||
}
|
||||
]);
|
||||
appIcon.setContextMenu(contextMenu);
|
||||
|
||||
appIcon.on('click', () => {
|
||||
console.log('I am here!');
|
||||
|
||||
mainWindow.show();
|
||||
});
|
||||
});
|
||||
|
||||
app.on('ready', () => {
|
||||
|
|
@ -117,6 +123,10 @@ app.on('ready', () => {
|
|||
setInterval(trackTimeFn, CONFIG.PING_INTERVAL);
|
||||
});
|
||||
|
||||
app.on('before-quit', () => {
|
||||
appIcon.destroy();
|
||||
});
|
||||
|
||||
// listen to events from frontend
|
||||
electron.ipcMain.on('SHUTDOWN', () => {
|
||||
app.isQuiting = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue