Skip to content

Commit aa58698

Browse files
committed
feat(linux): read icon
1 parent b95fd11 commit aa58698

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

src/main/linux.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,21 @@ export class LinuxAdapter extends Adapter {
4949

5050
if (!fs.existsSync(path.join(exePath, '../resources/electron.asar'))) return
5151

52+
let icon = ''
53+
if (entry.Icon) {
54+
try {
55+
const iconBuffer = await fs.promises.readFile(
56+
`/usr/share/icons/hicolor/1024x1024/apps/${entry.Icon}.png`,
57+
)
58+
icon = 'data:image/png;base64,' + iconBuffer.toString('base64')
59+
} catch (err) {
60+
console.error(err)
61+
}
62+
}
63+
5264
return {
5365
id: exePath,
54-
icon: '', // TODO: Read icon
66+
icon: icon, // TODO: Read icon
5567
name: entry.Name || path.basename(exePath),
5668
exePath: exePath,
5769
}

0 commit comments

Comments
 (0)