fix #43, #44: windows minimize to tray bugfix

This commit is contained in:
Antelle 2015-11-22 21:18:54 +03:00
parent 2dfca40246
commit 8407c76046
5 changed files with 31 additions and 9 deletions

View File

@ -54,7 +54,7 @@ if (window.process && window.process.versions && window.process.versions.electro
return false;
},
exit: function() {
Launcher.exitRequested = true;
this.exitRequested = true;
this.requestExit();
},
requestExit: function() {
@ -85,6 +85,9 @@ if (window.process && window.process.versions && window.process.versions.electro
return process.platform === 'win32';
}
};
Backbone.on('launcher-exit-request', function() {
setTimeout(function() { Launcher.exit(); }, 0);
});
window.launcherOpen = function(path) {
Backbone.trigger('launcher-open-file', path);
};

View File

@ -10,6 +10,7 @@ var app = require('app'),
Tray = require('tray');
var mainWindow = null,
appIcon = null,
openFile = process.argv.filter(function(arg) { return /\.kdbx$/i.test(arg); })[0],
ready = false,
restartPending = false,
@ -65,15 +66,30 @@ app.minimizeApp = function() {
if (process.platform === 'win32') {
mainWindow.minimize();
mainWindow.setSkipTaskbar(true);
var appIcon = new Tray(path.join(__dirname, 'icon.png'));
appIcon.on('clicked', function () {
mainWindow.restore();
mainWindow.setSkipTaskbar(false);
});
appIcon = new Tray(path.join(__dirname, 'icon.png'));
appIcon.on('clicked', restoreMainWindow);
var contextMenu = Menu.buildFromTemplate([
{ label: 'Open KeeWeb', click: restoreMainWindow },
{ label: 'Quit KeeWeb', click: closeMainWindow }
]);
appIcon.setContextMenu(contextMenu);
appIcon.setToolTip('KeeWeb');
}
};
function restoreMainWindow() {
appIcon.destroy();
appIcon = null;
mainWindow.restore();
mainWindow.setSkipTaskbar(false);
}
function closeMainWindow() {
appIcon.destroy();
appIcon = null;
mainWindow.webContents.executeJavaScript('Backbone.trigger("launcher-exit-request");');
}
function setMenu() {
if (process.platform === 'darwin') {
var name = require('app').getName();

View File

@ -1,6 +1,6 @@
{
"name": "KeeWeb",
"version": "0.4.2",
"version": "0.4.3",
"description": "KeePass web app",
"main": "main.js",
"repository": "https://github.com/antelle/keeweb",

View File

@ -1,6 +1,6 @@
{
"name": "keeweb",
"version": "0.4.2",
"version": "0.4.3",
"description": "KeePass web app",
"main": "Gruntfile.js",
"repository": "https://github.com/antelle/keeweb",

View File

@ -1,7 +1,10 @@
Release notes
-------------
##### v0.4.3 (2015-11-22)
Windows minimize to tray bugfix
##### v0.4.1, v0.4.2 (2015-11-22)
Auto-update bugfixes
Auto-update and bugfixes
##### v0.4.0 (2015-11-22)
Locking, better Dropbox, custom icons, security enhancements, bugfixes