Browse Source

Debug & ajustement

Loquicom 5 years ago
parent
commit
ca7a345761

+ 8 - 5
app/main/function/tray.js

@@ -5,11 +5,12 @@ const tray = {};
 
 tray.openApp = function () {
     if (appIcon) {
+        // Set tray inactive
+        trayInactive = true;
+        // Remove tray
         appIcon.destroy();
         // Re create the main window on dashboard page and close the invisible window
-        const newWindow = window.new(path.join(__dirname, '../../renderer/page/dashboard/dashboard.html'));
-        mainWindow.close();
-        mainWindow = newWindow;
+        mainWindow = window.new(path.join(__dirname, '../../renderer/page/dashboard/dashboard.html'));
     }
 };
 
@@ -21,13 +22,15 @@ tray.closeApp = function () {
 }
 
 tray.active = function () {
+    // Set tray active
+    trayInactive = false;
+    // Create tray
     appIcon = new Tray(path.join(__dirname, '../asset/tray.png'));
     appIcon.setToolTip('Electronotes');
     appIcon.setContextMenu(menu);
     // Hide app
-    const invisibleWindow = window.hidden(); // Create invisible window to avoid closing the app when all window are closed
     mainWindow.close();
-    mainWindow = invisibleWindow;
+    mainWindow = null;
     // Left click => open app
     appIcon.on('click', (event) => {
         tray.openApp();

+ 1 - 1
app/renderer/common/css/style.min.css

@@ -1 +1 @@
-body{display:flex;min-height:100vh;flex-direction:column}main{flex:1 0 auto}video{width:100%;height:100%}.hide{display:none}.zoom-in{cursor:zoom-in}.pointer{cursor:pointer}.selectable:hover{opacity:0.7}.bg-loader{width:100vw;height:100vh;position:absolute;z-index:4}.loader{width:50vh;z-index:5;top:50%;left:50%;transform:translate(-50%, -50%)}.mtop-half{margin-top:.5em}.mtop-1{margin-top:1em}.mbot-1{margin-bottom:1em}.mleft-1{margin-left:1em}.mright-1{margin-right:1em}.mtop-2{margin-top:2em}.mbot-2{margin-bottom:2em}.mleft-2{margin-left:2em}.mright-2{margin-right:2em}.mtop-3{margin-top:3em}.mbot-3{margin-bottom:3em}.mleft-3{margin-left:3em}.mright-3{margin-right:3em}.mtop-4{margin-top:4em}.mbot-4{margin-bottom:4em}.mleft-4{margin-left:4em}.mright-4{margin-right:4em}.mtop-5{margin-top:5em}.mbot-5{margin-bottom:5em}.mleft-5{margin-left:5em}.mright-5{margin-right:5em}
+body{display:flex;min-height:100vh;flex-direction:column}main{flex:1 0 auto}video{width:100%;height:100%}.hide{display:none}.zoom-in{cursor:zoom-in}.pointer{cursor:pointer}.selectable:hover{opacity:0.7}.bg-loader{width:100vw;height:100vh;position:absolute;z-index:4}.loader{width:50vh;z-index:5;top:50%;left:50%;transform:translate(-50%, -50%)}.border{border:1px gray solid}.mtop-half{margin-top:.5em}.mtop-1{margin-top:1em}.mbot-1{margin-bottom:1em}.mleft-1{margin-left:1em}.mright-1{margin-right:1em}.mtop-2{margin-top:2em}.mbot-2{margin-bottom:2em}.mleft-2{margin-left:2em}.mright-2{margin-right:2em}.mtop-3{margin-top:3em}.mbot-3{margin-bottom:3em}.mleft-3{margin-left:3em}.mright-3{margin-right:3em}.mtop-4{margin-top:4em}.mbot-4{margin-bottom:4em}.mleft-4{margin-left:4em}.mright-4{margin-right:4em}.mtop-5{margin-top:5em}.mbot-5{margin-bottom:5em}.mleft-5{margin-left:5em}.mright-5{margin-right:5em}

+ 4 - 0
app/renderer/common/css/style.scss

@@ -44,6 +44,10 @@ video {
     transform: translate(-50%, -50%);
 }
 
+.border {
+    border: 1px gray solid;
+}
+
 .mtop-half {
     margin-top: .5em;
 }

+ 1 - 1
app/renderer/common/js/event.js

@@ -1,7 +1,7 @@
 ipcRenderer.on('reset-app', (event, arg) => {
     loader();
     DataService.reset();
-    RouteService.reload();
+    RouterService.reload();
 });
 
 ipcRenderer.on('app-loader', (event, arg) => {

+ 1 - 1
app/renderer/page/dialog/dialog.html

@@ -8,7 +8,7 @@
         <link type="text/css" rel="stylesheet" href="../../common/css/style.min.css"  media="screen,projection"/>
         <title>Electronotes</title>
     </head>
-    <body class="grey lighten-4">
+    <body class="grey lighten-4 border">
         <main class="contianer">
             <div class="row mtop-2">
                 <div class="col s12 center-align">

+ 1 - 1
config.json

@@ -5,7 +5,7 @@
     },
     "dialog": {
         "width": 700,
-        "height": 320
+        "height": 330
     },
     "defaultExportToMarkdown": true
 }

+ 4 - 1
main.js

@@ -18,7 +18,9 @@ if (require('electron-squirrel-startup')) { // eslint-disable-line global-requir
 // Global var
 global.mainWindow;
 global.exportToMd;
+global.trayInactive;
 exportToMd = config.defaultExportToMarkdown;
+trayInactive = true;
 let launchInfo;
 let indexFile = 'index.html';
 
@@ -100,7 +102,8 @@ app.on('ready', main);
 app.on('window-all-closed', () => {
   // On OS X it is common for applications and their menu bar
   // to stay active until the user quits explicitly with Cmd + Q
-  if (process.platform !== 'darwin') {
+  // The application don't quit if the tray is active
+  if (process.platform !== 'darwin' && trayInactive) {
     app.quit();
   }
 });