mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2024-11-11 07:41:04 +00:00
Refactorize hardcoded icon path to main.js for more general usage
This commit is contained in:
parent
8041663d82
commit
7273a63885
@ -39,7 +39,8 @@ function createMainWindow(options, onAppQuit, setDockBadge) {
|
|||||||
preload: path.join(__dirname, 'static', 'preload.js')
|
preload: path.join(__dirname, 'static', 'preload.js')
|
||||||
},
|
},
|
||||||
// after webpack path here should reference `resources/app/`
|
// after webpack path here should reference `resources/app/`
|
||||||
icon: path.join(__dirname, '../', '/icon.png')
|
icon: options.icon
|
||||||
|
//icon: path.join(__dirname, '../', '/icon.png')
|
||||||
});
|
});
|
||||||
|
|
||||||
let currentZoom = 1;
|
let currentZoom = 1;
|
||||||
|
@ -10,15 +10,21 @@ const {app, ipcMain} = electron;
|
|||||||
const {isOSX} = helpers;
|
const {isOSX} = helpers;
|
||||||
|
|
||||||
const APP_ARGS_FILE_PATH = path.join(__dirname, '..', 'nativefier.json');
|
const APP_ARGS_FILE_PATH = path.join(__dirname, '..', 'nativefier.json');
|
||||||
|
|
||||||
const appArgs = JSON.parse(fs.readFileSync(APP_ARGS_FILE_PATH, 'utf8'));
|
const appArgs = JSON.parse(fs.readFileSync(APP_ARGS_FILE_PATH, 'utf8'));
|
||||||
|
|
||||||
|
const DEFAULT_ICON_PATH = path.join(__dirname, '/icon.png');
|
||||||
|
const Tray = electron.Tray;
|
||||||
|
|
||||||
let mainWindow;
|
let mainWindow;
|
||||||
|
|
||||||
if (appArgs.insecure) {
|
if (appArgs.insecure) {
|
||||||
app.commandLine.appendSwitch('ignore-certificate-errors');
|
app.commandLine.appendSwitch('ignore-certificate-errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!appArgs.icon){
|
||||||
|
appArgs.icon = DEFAULT_ICON_PATH;
|
||||||
|
}
|
||||||
|
|
||||||
// do nothing for setDockBadge if not OSX
|
// do nothing for setDockBadge if not OSX
|
||||||
let setDockBadge = () => {};
|
let setDockBadge = () => {};
|
||||||
|
|
||||||
@ -53,8 +59,11 @@ app.on('before-quit', () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let appIcon = null;
|
||||||
app.on('ready', () => {
|
app.on('ready', () => {
|
||||||
mainWindow = createMainWindow(appArgs, app.quit, setDockBadge);
|
mainWindow = createMainWindow(appArgs, app.quit, setDockBadge);
|
||||||
|
|
||||||
|
appIcon = new Tray(appArgs.icon);
|
||||||
});
|
});
|
||||||
|
|
||||||
app.on('login', (event, webContents, request, authInfo, callback) => {
|
app.on('login', (event, webContents, request, authInfo, callback) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user