Skip to content

Commit

Permalink
Fixing win32 issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
emilioastarita committed Sep 3, 2016
1 parent e0ba467 commit 012b868
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 6 deletions.
22 changes: 19 additions & 3 deletions Lyricfier.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import electron = require('electron');
import storage = require('electron-json-storage');
import BrowserWindow = Electron.BrowserWindow;
const platform = require('os').platform();
const path = require('path');


interface Settings {

Expand All @@ -24,11 +27,24 @@ export class Lyricfier {
});
}

getTrayIcon() {

let trayImage = this.getImg('icon.png');
// Determine appropriate icon for platform
if (platform == 'darwin') {
trayImage = this.getImg('tray-icon-mac.png');
}
else if (platform == 'win32') {
trayImage = this.getImg('tray-icon-win.ico');
}
return trayImage;
}

createWindow() {
let options = {
width: 500,
height: 600,
icon: this.getImg('icon.png'),
icon: this.getTrayIcon(),
frame: false,
show: false
};
Expand All @@ -50,7 +66,7 @@ export class Lyricfier {
}

createAppIcon() {
const iconPath = this.getImg('icon.png');
const iconPath = this.getTrayIcon();
this.appIcon = new electron.Tray(iconPath);
this.appIcon.setContextMenu(this.createTrayMenu());
}
Expand Down Expand Up @@ -85,7 +101,7 @@ export class Lyricfier {
}

getImg(name) {
return `/${this.rootDir}/render/img/${name}`;
return path.join(this.rootDir, 'render', 'img', name );
}

getView(name) {
Expand Down
13 changes: 10 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@
"scripts": {
"prestart": "tsc",
"start": "electron .",
"dist:linux64": "electron-zip-packager . --arch=x64 --platform=linux --overwrite --prune --out=build/ --icon=render/img/icon.png",
"dist:linux32": "electron-zip-packager . --arch=ia32 --platform=linux --overwrite --prune --out=build/ --icon=render/img/icon.png",
"dist:win32": "electron-zip-packager . --arch=ia32 --platform=win32 --overwrite --prune --out=build/ --icon=render/img/icon.ico",
"dist:win64": "electron-zip-packager . --arch=x64 --platform=win32 --overwrite --prune --out=build/ --icon=render/img/icon.ico",
"dist:mac": "electron-zip-packager . --arch=x64 --platform=mas --overwrite --prune --out=build/ --icon=render/img/icon.icns",
"predist": "tsc",
"dist": "electron-zip-packager . --all --overwrite --prune --out=build/"
"dist": "npm run dist:linux64 && npm run dist:linux32 && npm run dist:win32 && npm run dist:win64 && npm run dist:mac"
},
"repository": {
"type": "git",
Expand All @@ -30,16 +35,18 @@
"cheerio": "^0.20.0",
"electron-json-storage": "^2.0.0",
"he": "^1.1.0",
"jquery": "^3.1.0",
"request": "^2.74.0",
"toastr": "^2.1.2",
"vue-class-component": "^3.2.0",
"vue": "^1.0.26"
"vue": "^1.0.26",
"vue-class-component": "^3.2.0"
},
"devDependencies": {
"@types/electron": "latest",
"@types/electron-json-storage": "latest",
"@types/node": "4.0.30",
"@types/vue": "latest",
"electron-builder": "^6.4.0",
"electron-packager": "^7.7.0",
"electron-prebuilt": "^1.2.0",
"electron-zip-packager": "^3.0.0",
Expand Down
Binary file added render/img/icon.icns
Binary file not shown.
Binary file added render/img/icon.ico
Binary file not shown.
Binary file modified render/img/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added render/img/tray-icon-mac.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added render/img/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added render/img/tray-icon-win.ico
Binary file not shown.

0 comments on commit 012b868

Please sign in to comment.