Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.

Commit 0c35714

Browse files
authored
Merge pull request #1099 from TriliumNext/refactor_simplify-electron-desktop-ejs
refactor(bin/electron-forge): make desktop.ejs easier to read
2 parents 67b4601 + 61e5602 commit 0c35714

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

bin/electron-forge/desktop.ejs

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
[Desktop Entry]
2-
<% if (productName) { %>Name=<%= productName %>
3-
<% } %><% if (description) { %>Comment=<%= description %>
4-
<% } %><% if (genericName) { %>GenericName=<%= genericName %>
5-
<% } %><% if (name) { %>Exec=<%= name %> %U
6-
Icon=<%= name %>
7-
<% } %>Type=Application
8-
StartupNotify=true
9-
<% if (productName) { %>StartupWMClass=<%= productName %>
10-
<% } if (categories && categories.length) { %>Categories=<%= categories.join(';') %>;
11-
<% } %><% if (mimeType && mimeType.length) { %>MimeType=<%= mimeType.join(';') %>;
12-
<% } %>
2+
<%=
3+
Object.entries({
4+
"Name": productName,
5+
"Comment": description,
6+
"GenericName": genericName,
7+
"Exec": name ? `${name} %U` : undefined,
8+
"Icon": name,
9+
"Type": "Application",
10+
"StartupNotify": "true",
11+
"StartupWMClass": productName,
12+
"Categories": categories?.length ? `${categories.join(";")};` : undefined,
13+
"MimeType": mimeType?.length ? `${mimeType.join(";")};` : undefined
14+
})
15+
.map(line => line[1] ? line.join("=") : undefined)
16+
.filter(line => !!line)
17+
.join("\n")%>

0 commit comments

Comments
 (0)