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