Skip to content
This repository has been archived by the owner on Sep 8, 2021. It is now read-only.

Commit

Permalink
Fix icons in MacOS
Browse files Browse the repository at this point in the history
  • Loading branch information
1nikolas committed Sep 16, 2020
1 parent e0aa50c commit 0b3a3a4
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
"description": " Get the lyrics of what you're listening on Tidal",
"main": "src/index.js",
"win": {
"icon": "./icon.ico"
"icon": "./src/images/icon.ico"
},
"mac": {
"icon": "./src/images/icon.icns"
},
"scripts": {
"start": "electron-forge start",
Expand All @@ -24,14 +27,14 @@
"config": {
"forge": {
"packagerConfig": {
"icon": "icon.ico"
"icon": "./src/images/icon.icns"
},
"makers": [
{
"name": "@electron-forge/maker-squirrel",
"config": {
"name": "tidal_lyrics",
"iconUrl": "https://raw.githubusercontent.com/1nikolas/tidal-lyrics/master/icon.ico"
"iconUrl": "https://raw.githubusercontent.com/1nikolas/tidal-lyrics/master/src/images/icon.ico"
}
},
{
Expand Down
Binary file added src/images/icon.icns
Binary file not shown.
File renamed without changes.
21 changes: 17 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { app, BrowserWindow, Menu, ipcMain, dialog } = require('electron');
const { app, BrowserWindow, Menu, ipcMain, dialog, nativeImage } = require('electron');
const remote = require("electron").remote;
const path = require('path');
const { exec } = require("child_process");
Expand Down Expand Up @@ -44,15 +44,24 @@ const createWindow = () => {
if (body.replace(/(\r\n|\n|\r)/gm, "") != app.getVersion()) {

//update available
var dialogIcon = null
if (process.platform == "darwin"){
dialogIcon = __dirname + "/images/icon.png"
}
dialog.showMessageBox(mainWindow, {
type: "info",
buttons: ["Update"],
buttons: ["Update", "Dismiss"],
message: "An update is available!",
icon: dialogIcon,
cancelId: 1
}).then(result => {
if (result.response === 0) {
require('electron').shell.openExternal("https://github.com/1nikolas/tidal-lyrics/releases");
app.quit();
if (process.platform == "win32"){
app.quit()
} else if (process.platform == "darwin"){
setTimeout(app.quit(), 1000);
}
}
})

Expand Down Expand Up @@ -93,7 +102,7 @@ const createWindow = () => {
dialog.showMessageBox(mainWindow, {
buttons: ["OK", "Visit tidal-lyrics on Github"],
message: "tidal-lyrics " + app.getVersion() + "\nMade by Nikolas Spiridakis",
icon: path.join(__dirname + "./images/icon.png")
icon: __dirname + "/images/icon.png"
}).then(result => {
if (result.response === 1) {
require('electron').shell.openExternal("https://github.com/1nikolas/tidal-lyrics/");
Expand All @@ -106,6 +115,10 @@ const createWindow = () => {

};

if (process.platform == "darwin"){
app.dock.setIcon(nativeImage.createFromPath(__dirname + "/images/icon.png"));
}

app.on('ready', createWindow);

// For MacOS
Expand Down

0 comments on commit 0b3a3a4

Please sign in to comment.