mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2024-12-23 02:28:55 +00:00
parent
8963544afa
commit
1c8d04e532
@ -7,7 +7,7 @@ import createMenu from './../menu/menu';
|
||||
import initContextMenu from './../contextMenu/contextMenu';
|
||||
|
||||
const {
|
||||
isOSX, linkIsInternal, getCssToInject, shouldInjectCss,
|
||||
isOSX, linkIsInternal, getCssToInject, shouldInjectCss, getAppIcon,
|
||||
} = helpers;
|
||||
|
||||
const ZOOM_INTERVAL = 0.1;
|
||||
@ -86,7 +86,7 @@ function createMainWindow(inpOptions, onAppQuit, setDockBadge) {
|
||||
zoomFactor: options.zoom,
|
||||
},
|
||||
// after webpack path here should reference `resources/app/`
|
||||
icon: path.join(__dirname, '../', '/icon.png'),
|
||||
icon: getAppIcon(),
|
||||
// set to undefined and not false because explicitly setting to false will disable full screen
|
||||
fullscreen: options.fullScreen || undefined,
|
||||
});
|
||||
|
@ -1,9 +1,11 @@
|
||||
import path from 'path';
|
||||
import helpers from './../../helpers/helpers';
|
||||
|
||||
const {
|
||||
app, Tray, Menu, ipcMain,
|
||||
app, Tray, Menu, ipcMain, nativeImage,
|
||||
} = require('electron');
|
||||
|
||||
const { getAppIcon } = helpers;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {{}} inpOptions AppArgs from nativefier.json
|
||||
@ -14,8 +16,9 @@ function createTrayIcon(inpOptions, mainWindow) {
|
||||
const options = Object.assign({}, inpOptions);
|
||||
|
||||
if (options.tray) {
|
||||
const iconPath = path.join(__dirname, '../', '/icon.png');
|
||||
const appIcon = new Tray(iconPath);
|
||||
const iconPath = getAppIcon();
|
||||
const nimage = nativeImage.createFromPath(iconPath);
|
||||
const appIcon = new Tray(nimage);
|
||||
|
||||
const onClick = () => {
|
||||
if (mainWindow.isVisible()) {
|
||||
|
@ -55,6 +55,10 @@ function debugLog(browserWindow, message) {
|
||||
console.log(message);
|
||||
}
|
||||
|
||||
function getAppIcon() {
|
||||
return path.join(__dirname, '../', `/icon.${isWindows() ? 'ico' : 'png'}`);
|
||||
}
|
||||
|
||||
export default {
|
||||
isOSX,
|
||||
isLinux,
|
||||
@ -63,4 +67,5 @@ export default {
|
||||
getCssToInject,
|
||||
debugLog,
|
||||
shouldInjectCss,
|
||||
getAppIcon,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user