From 9b3343cce6430032664646e79049ec7f2b045744 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Korszu=C5=84?= Date: Mon, 22 Jan 2018 21:39:46 +0100 Subject: [PATCH] ubuntu fix --- main.ts | 19 +++++++++++++++++-- package.js | 2 +- package.json | 11 +++++------ src/app/services/timer.service.ts | 4 ++-- 4 files changed, 25 insertions(+), 11 deletions(-) diff --git a/main.ts b/main.ts index 6231352..f5a3d05 100644 --- a/main.ts +++ b/main.ts @@ -77,7 +77,7 @@ try { // app.on('ready', createWindow); app.on('ready', () => { let trayImage = '' - if (process.platform == 'darwin') { + if (process.platform == 'darwin' || process.platform == 'linux') { trayImage = './assets/tray/osx/icon_tray-normal.png'; } else if (process.platform == 'win32') { @@ -111,6 +111,8 @@ try { show: false }) + + splash = new BrowserWindow({ width: 400, height: 420, @@ -123,6 +125,7 @@ try { pathname: path.join(__dirname, 'splash.html'), protocol: 'file', slashes: true, + icon: __dirname + '/assets/trec-logo.png' })) mainWindow.loadURL(url.format({ @@ -130,7 +133,19 @@ try { protocol: 'file', slashes: true, icon: __dirname + '/assets/trec-logo.png' - })) + })) + + mainWindow.webContents.executeJavaScript(` + var path = require('path'); + module.paths.push(path.resolve('node_modules')); + module.paths.push(path.resolve('../node_modules')); + module.paths.push(path.resolve(__dirname, '..', '..', 'electron', 'node_modules')); + module.paths.push(path.resolve(__dirname, '..', '..', 'electron.asar', 'node_modules')); + module.paths.push(path.resolve(__dirname, '..', '..', 'app', 'node_modules')); + module.paths.push(path.resolve(__dirname, '..', '..', 'app.asar', 'node_modules')); + path = undefined; + `); + splash.once("ready-to-show", () => { splash.show() }) setTimeout(() => { diff --git a/package.js b/package.js index a7e8639..606203a 100644 --- a/package.js +++ b/package.js @@ -36,7 +36,7 @@ function pack(plat, arch, cb) { if (icon) { DEFAULT_OPTS.icon = icon + (() => { - let extension = '.png'; + let extension = '.ico'; if (plat === 'darwin') { extension = '.icns'; } else if (plat === 'win32') { diff --git a/package.json b/package.json index f183fd7..4fde816 100644 --- a/package.json +++ b/package.json @@ -34,13 +34,13 @@ "test": "karma start ./karma.conf.js", "pree2e": "webdriver-manager update --standalone false --gecko false --quiet && npm run build", "e2e": "protractor ./protractor.conf.js", - "postinstall": "electron-rebuild -f -w sqlite3", - "electron-rebuild": "electron-rebuild -f -w sqlite3" + "postinstall": "electron-rebuild -f -w sqlite3,@paulcbetts/system-idle-time", + "electron-rebuild": "electron-rebuild -f -w sqlite3,@paulcbetts/system-idle-time" }, "dependencies": { - "@paulcbetts/system-idle-time": "git+https://github.com/paulcbetts/node-system-idle-time.git", - "sqlite3": "^3.1.13", - "electron-notifications": "^1.0.0" + "@paulcbetts/system-idle-time": "^1.0.4", + "electron-notifications": "^1.0.0", + "sqlite3": "^3.1.13" }, "devDependencies": { "@angular/animations": "^4.4.3", @@ -56,7 +56,6 @@ "ionicons": "^3.0.0", "ngx-loading": "^1.0.8", "rxjs": "5.4.3", - "zone.js": "0.8.17", "@angular/compiler": "4.4.3", "electron-builder": "^19.37.2", diff --git a/src/app/services/timer.service.ts b/src/app/services/timer.service.ts index a2367f6..dfd56df 100644 --- a/src/app/services/timer.service.ts +++ b/src/app/services/timer.service.ts @@ -159,7 +159,7 @@ export class TimerService { public trayRecording() { let iconPath = '' - if (process.platform == 'darwin') { + if (process.platform == 'darwin' || process.platform == 'linux') { iconPath = path.join(__dirname, './assets/tray/osx/icon_tray-recording.png') } else if (process.platform == 'win32') { @@ -169,7 +169,7 @@ export class TimerService { public trayDefault() { let iconPath = '' - if (process.platform == 'darwin') { + if (process.platform == 'darwin' || process.platform == 'linux') { iconPath = path.join(__dirname, './assets/tray/osx/icon_tray-normal.png') } else if (process.platform == 'win32') {