Closed
Description
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch app-builder-lib@24.13.3
for the project I'm working on.
As far as I could tell, electron-builder does not support specifying desktop action entries in .desktop file (https://www.electronjs.org/docs/latest/tutorial/linux-desktop-actions). So I patched the LinuxTargetHelpers.js file to support it quickly:
diff --git a/node_modules/app-builder-lib/out/targets/LinuxTargetHelper.js b/node_modules/app-builder-lib/out/targets/LinuxTargetHelper.js
index c3f1000..bda9496 100644
--- a/node_modules/app-builder-lib/out/targets/LinuxTargetHelper.js
+++ b/node_modules/app-builder-lib/out/targets/LinuxTargetHelper.js
@@ -155,11 +155,26 @@ class LinuxTargetHelper {
}
}
desktopMeta.Categories = `${category}${category.endsWith(";") ? "" : ";"}`;
+
let data = `[Desktop Entry]`;
for (const name of Object.keys(desktopMeta)) {
- data += `\n${name}=${desktopMeta[name]}`;
+ if (name != "DesktopActions") {
+ data += `\n${name}=${desktopMeta[name]}`;
+ }
}
data += "\n";
+
+ // Specify Desktop Actions
+ if (desktopMeta.DesktopActions) {
+ for (const actionName of Object.keys(desktopMeta.DesktopActions)) {
+ const action = desktopMeta.DesktopActions[actionName];
+ data += `\n[Desktop Action ${actionName}]`;
+ for (const name of Object.keys(action)) {
+ data += `\n${name}=${action[name]}`;
+ }
+ data += "\n";
+ }
+ }
return Promise.resolve(data);
}
}
For a config file like the following:
DesktopActions: {
NewWindow: {
Name: 'New Window',
Exec: 'app --new-window',
},
},
Are there any plans to support this soon, or should I propose a more robust solution?
This issue body was partially generated by patch-package.
Metadata
Metadata
Assignees
Labels
No labels