I am trying to set up a icon in the Tasks section of the Jump List for my Electron app. I already successfully set up a icon in the task bar. But I also want to set up my icon in the Tasks section of the Jump List. How can I do that?
I already tried to use the app.setUserTask() method and tried to set up a icon in my JSON file. The icon in the task bar and the icon in the its self is working. I also tried using .ico and .png.
The description and the title are working so I guess that I am doing something wrong with the path or something similar. The ico and png image are in the same directory as my main.js (for Electron).
app.setUserTasks([
{
program: process.execPath,
arguments: '--new-window',
iconPath: path.join(__dirname,"icon.ico").execPath,
iconIndex: 1,
title: 'myApp',
description: 'myApp'
}
])
First of all, it looks like you mixed up two things in your
iconPath. According to the Electron docs, you can useprocess.execPathto refer to the application executable or use any other absolute path. Sincepath.joinreturns a string, it won't have theexecPathproperty. Secondly, I changed theiconIndexto 0.The following was tested on Windows 7 and Electron 4.1.4:
It appears that PNG files do not work at all – you'll need to use ICO files for the Jump List. Furthermore, the icon cannot be taken from the
asar. This means you need an ICO directly in the filesystem and you need to provide an absolute path to it.Complete code sample:
Here,
doesn't workmeans a default icon is shown by Windows. I made sure thaticon.pngandicon.icowere in theapp.asar.