Browse Source

Ajout mesures anti-disparition de Pitaya en mode desktop

feature/remote-launch
William Petit 3 years ago
parent
commit
bb26fc2759
3 changed files with 20 additions and 0 deletions
  1. 4
    0
      default-profile.json
  2. 9
    0
      main.js
  3. 7
    0
      src/store/actions/launcher.js

+ 4
- 0
default-profile.json View File

@@ -14,6 +14,10 @@
14 14
               "icon": "chromium-browser",
15 15
               "exec": "/usr/bin/chromium-browser",
16 16
               "_key": "item_1444480285022_3"
17
+            },
18
+            {
19
+              "label": "Pitaya Edit",
20
+              "exec": "PITAYA_MODE=edit PITAYA_AS_DESKTOP=0 npm start"
17 21
             }
18 22
           ],
19 23
           "_key": "item_1444480285022_2"

+ 9
- 0
main.js View File

@@ -40,6 +40,15 @@ app.on('ready', function() {
40 40
     mainWindow = null;
41 41
   });
42 42
 
43
+  mainWindow.on('blur', function() {
44
+    Util.Logger.info('Focus loosed.');
45
+  });
46
+
47
+  mainWindow.on('focus', function() {
48
+    Util.Logger.info('Focus gained.');
49
+    mainWindow.show();
50
+  });
51
+
43 52
 });
44 53
 
45 54
 process.on('exit', function(code) {

+ 7
- 0
src/store/actions/launcher.js View File

@@ -1,5 +1,6 @@
1 1
 var Util = require('../../util');
2 2
 var logger = Util.Logger;
3
+var remote = require('remote');
3 4
 
4 5
 var RUN_APP = exports.RUN_APP = 'RUN_APP';
5 6
 var RUN_APP_SUCCESS = exports.RUN_APP_SUCCESS = 'RUN_APP_SUCCESS';
@@ -16,10 +17,16 @@ exports.runApp = function(execPath) {
16 17
     return Util.System.runApp(execPath, { clearFreeDesktopFlags: true })
17 18
       .then(function() {
18 19
         dispatch({ type: RUN_APP_SUCCESS, execPath: execPath });
20
+        // Hypothetical fix
21
+        var win = remote.getCurrentWindow();
22
+        win.show();
19 23
         return execPath;
20 24
       })
21 25
       .catch(function(err) {
22 26
         dispatch({ type: RUN_APP_FAILED, error: err });
27
+        // Hypothetical fix
28
+        var win = remote.getCurrentWindow();
29
+        win.show();
23 30
         return err;
24 31
       })
25 32
     ;

Loading…
Cancel
Save