Fix app icon in taskbar and generate a mageia compatible RPM
This commit is contained in:
+39
-12
@@ -1,3 +1,23 @@
|
||||
const path = require('path');
|
||||
const redhatDependencies = require('electron-installer-redhat/src/dependencies');
|
||||
|
||||
const linuxIconSet = {
|
||||
'16x16': 'appicons/icons/png/16x16.png',
|
||||
'24x24': 'appicons/icons/png/24x24.png',
|
||||
'32x32': 'appicons/icons/png/32x32.png',
|
||||
'48x48': 'appicons/icons/png/48x48.png',
|
||||
'64x64': 'appicons/icons/png/64x64.png',
|
||||
'128x128': 'appicons/icons/png/128x128.png',
|
||||
'256x256': 'appicons/icons/png/256x256.png',
|
||||
'512x512': 'appicons/icons/png/512x512.png',
|
||||
};
|
||||
|
||||
const linuxDesktopTemplate = path.resolve(__dirname, 'packaging/linux/trimsp.desktop.ejs');
|
||||
|
||||
// The upstream RPM maker assumes Fedora-style package names. Mageia provides
|
||||
// GTK 3 under lib64gtk+3_0, so allow either name in the generated Requires.
|
||||
redhatDependencies.dependencyMap.gtk3 = '(gtk3 or lib64gtk+3_0)';
|
||||
|
||||
module.exports = {
|
||||
packagerConfig: {
|
||||
icon: 'appicons/icons/png/1024x1024.png',
|
||||
@@ -25,11 +45,27 @@ module.exports = {
|
||||
},
|
||||
{
|
||||
name: '@electron-forge/maker-deb',
|
||||
config: {},
|
||||
config: {
|
||||
name: 'trimsp',
|
||||
productName: 'TrimSP',
|
||||
genericName: 'Ion implantation simulator',
|
||||
description: 'TRIM.SP simulation GUI for ion implantation studies.',
|
||||
categories: ['Science'],
|
||||
icon: linuxIconSet,
|
||||
desktopTemplate: linuxDesktopTemplate,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: '@electron-forge/maker-rpm',
|
||||
config: {},
|
||||
config: {
|
||||
name: 'trimsp',
|
||||
productName: 'TrimSP',
|
||||
genericName: 'Ion implantation simulator',
|
||||
description: 'TRIM.SP simulation GUI for ion implantation studies.',
|
||||
categories: ['Science'],
|
||||
icon: linuxIconSet,
|
||||
desktopTemplate: linuxDesktopTemplate,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: '@electron-forge/maker-flatpak',
|
||||
@@ -42,16 +78,7 @@ module.exports = {
|
||||
baseVersion: '24.08',
|
||||
runtimeVersion: '24.08',
|
||||
extraFlatpakBuilderArgs: ['--state-dir=.flatpak-builder'],
|
||||
icon: {
|
||||
'16x16': 'appicons/icons/png/16x16.png',
|
||||
'24x24': 'appicons/icons/png/24x24.png',
|
||||
'32x32': 'appicons/icons/png/32x32.png',
|
||||
'48x48': 'appicons/icons/png/48x48.png',
|
||||
'64x64': 'appicons/icons/png/64x64.png',
|
||||
'128x128': 'appicons/icons/png/128x128.png',
|
||||
'256x256': 'appicons/icons/png/256x256.png',
|
||||
'512x512': 'appicons/icons/png/512x512.png',
|
||||
},
|
||||
icon: linuxIconSet,
|
||||
modules: [],
|
||||
categories: ['Science'],
|
||||
finishArgs: [
|
||||
|
||||
@@ -3,6 +3,8 @@ const { app, BrowserWindow, Menu, dialog, ipcMain, fs } = require('electron');
|
||||
|
||||
let currentWorkPath = process.cwd();
|
||||
|
||||
app.setName('TrimSP');
|
||||
|
||||
function showAboutDialog(parentWindow) {
|
||||
const detail = [
|
||||
'TRIM.SP simulation GUI for low-energy ion implantation studies.',
|
||||
@@ -45,11 +47,18 @@ function getDefaultDialogPath() {
|
||||
return currentWorkPath || process.cwd();
|
||||
}
|
||||
|
||||
function getWindowIconPath() {
|
||||
if (app.isPackaged) {
|
||||
return path.join(process.resourcesPath, 'app.asar', 'icon.png');
|
||||
}
|
||||
return path.join(__dirname, 'icon.png');
|
||||
}
|
||||
|
||||
function createWindow () {
|
||||
const win = new BrowserWindow({
|
||||
width: 1000,
|
||||
height: 610,
|
||||
icon: "/usr/lib/TrimSP/resources/app/icon.png",
|
||||
icon: getWindowIconPath(),
|
||||
webPreferences: {
|
||||
contextIsolation: false,
|
||||
nodeIntegration: true,
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
[Desktop Entry]
|
||||
Name=<%= productName %>
|
||||
<% if (description) { print(`Comment=${description}\n`) } %>GenericName=<%= genericName %>
|
||||
Exec=<%= name %> %U<% if (execArguments && execArguments.length) { %> <%= execArguments.join(' ') %><% } %>
|
||||
Icon=<%= name %>
|
||||
Type=Application
|
||||
StartupNotify=true
|
||||
StartupWMClass=TrimSP
|
||||
Categories=<%= categories.join(';') %>;
|
||||
<% if (mimeType && mimeType.length) { %>MimeType=<%= mimeType.join(';') %>;<% } %>
|
||||
Reference in New Issue
Block a user