Ajout mesures anti-disparition de Pitaya en mode desktop

This commit is contained in:
wpetit 2015-11-05 11:41:51 +01:00
parent 519ec99264
commit bb26fc2759
3 changed files with 20 additions and 0 deletions

View File

@ -14,6 +14,10 @@
"icon": "chromium-browser", "icon": "chromium-browser",
"exec": "/usr/bin/chromium-browser", "exec": "/usr/bin/chromium-browser",
"_key": "item_1444480285022_3" "_key": "item_1444480285022_3"
},
{
"label": "Pitaya Edit",
"exec": "PITAYA_MODE=edit PITAYA_AS_DESKTOP=0 npm start"
} }
], ],
"_key": "item_1444480285022_2" "_key": "item_1444480285022_2"

View File

@ -40,6 +40,15 @@ app.on('ready', function() {
mainWindow = null; mainWindow = null;
}); });
mainWindow.on('blur', function() {
Util.Logger.info('Focus loosed.');
});
mainWindow.on('focus', function() {
Util.Logger.info('Focus gained.');
mainWindow.show();
});
}); });
process.on('exit', function(code) { process.on('exit', function(code) {

View File

@ -1,5 +1,6 @@
var Util = require('../../util'); var Util = require('../../util');
var logger = Util.Logger; var logger = Util.Logger;
var remote = require('remote');
var RUN_APP = exports.RUN_APP = 'RUN_APP'; var RUN_APP = exports.RUN_APP = 'RUN_APP';
var RUN_APP_SUCCESS = exports.RUN_APP_SUCCESS = 'RUN_APP_SUCCESS'; var RUN_APP_SUCCESS = exports.RUN_APP_SUCCESS = 'RUN_APP_SUCCESS';
@ -16,10 +17,16 @@ exports.runApp = function(execPath) {
return Util.System.runApp(execPath, { clearFreeDesktopFlags: true }) return Util.System.runApp(execPath, { clearFreeDesktopFlags: true })
.then(function() { .then(function() {
dispatch({ type: RUN_APP_SUCCESS, execPath: execPath }); dispatch({ type: RUN_APP_SUCCESS, execPath: execPath });
// Hypothetical fix
var win = remote.getCurrentWindow();
win.show();
return execPath; return execPath;
}) })
.catch(function(err) { .catch(function(err) {
dispatch({ type: RUN_APP_FAILED, error: err }); dispatch({ type: RUN_APP_FAILED, error: err });
// Hypothetical fix
var win = remote.getCurrentWindow();
win.show();
return err; return err;
}) })
; ;