diff --git a/app.css b/app.css new file mode 100644 index 0000000..cf62660 --- /dev/null +++ b/app.css @@ -0,0 +1,5 @@ +/** + * Comunic WebApp custom stylesheet + * + * @author Comunic authors + */ \ No newline at end of file diff --git a/modules/MainWindow.js b/modules/MainWindow.js index da11d2a..e5ac127 100644 --- a/modules/MainWindow.js +++ b/modules/MainWindow.js @@ -10,6 +10,7 @@ const {Menu, Tray} = require('electron'); const Config = require("../Config"); const TrayMenu = require("./TrayMenu"); const ApplicationMenu = require("./ApplicationMenu"); +const fs = require("fs"); let mainWindow; @@ -58,5 +59,21 @@ exports.show = function(){ mainWindow.webContents.on('did-finish-load', function() { page_finished_loading = true; + + //Inject CSS + fs.readFile("./app.css", (err, data) => { + + //Check for errors + if(err){ + console.error("Error while loading ./app.css: " + err); + return; + } + + let style = data.toString(); + mainWindow.webContents.executeJavaScript("let style = document.createElement('style');" + + "style.innerHTML = decodeURIComponent(\""+encodeURIComponent(style)+"\");" + + "document.head.appendChild(style);"); + + }); }); } \ No newline at end of file