go-astilectron
go-astilectron copied to clipboard
[Bug] Windows 10 Jumplist tasks
Hi, Thanks for a great package!
I got an issue, when right clicking the app on windows 10 task bar, (aka jump list) There is a default task added with the electron name and icon. I did manage to change the name and icon with the use of rcedit, changing the icon and description....
But, when clicking on the default task it opens the electron.exe with no arguments. so the default electron window is opened..
I've also tested it with one of the demo apps and got the exact same results.
@dreisel this issue is a duplicate of https://github.com/asticode/go-astilectron/issues/269 if I'm not mistaken.
However this is good to know that you managed to update both icon and description using rcedit. Can you paste your solution here? I may incorporate it in the bundler process since it's already using rcedit.
I've been playing around with those functions but no luck so far... 😞
yea, that's exactly what i was trying to do. and it seems that event hard-coded values in the main electron files (edited the downloaded files in the AppData folder) seems to help. I'm afraid that the only solution is to compile the electron with the source code inside using one of the electron bundles and then communicating it with go parent service....
I'm working on a POC with https://electronforge.io/ but in order for the client to connect to the parent IPC we will need to refactor this area a bit.
here are the rc configs:
.\rcedit-x64.exe electron.exe --set-icon myicon.ico --set-version-string "CompanyName" "My CompanyName" --set-version-string "FileDescription" "My App Name" --set-version-string "LegalCopyright" "My copyright" --set-version-string "ProductName" "Axis"
And I don't think this is a duplicate of #269 there he refrences the app icon which works properly here. This issue is mainly concerning the default task which starts the electron.exe with no command line arguments.
@asticode I think i got a solution...
I would like to change the default_app.asar in the downloaded electron repo. and running the rcedit on the electron.exe before embedding it in the bundler.
instead of the original electron app, i would put the astilectron app in there. so when the electron jumps up with no arguments it will signal the other instance that he is alive.
WDYT?
@dreisel I don't really get your solution :
I would like to change the default_app.asar in the downloaded electron repo.
which default_app.asar
are you talking about ?
and running the rcedit on the electron.exe before embedding it in the bundler.
so your goal is to modify electron.exe
instead of the generated go binary ?
instead of the original electron app, i would put the astilectron app in there.
what do you mean by here
?
so when the electron jumps up with no arguments it will signal the other instance that he is alive.
which other instance
are you talking about ?
in the downloaded electron release.
the app that the electron displays:
is stored as an asar file in the electron zipped folder (under resources).
I would like to replace this file with the astilectron code.
my goal is to modify the electron.exe prior to embedding it into the go binary. (and possibly resigning it on release).
about the other instance, I'm assuming that the main electron window (which go-astilectron spawns up with the respective command line arguments) will be alive. so when the second instance of the electron spawns up (by clicking the button in the jump list). it will register as a single instance and the execution will stop, and call the main process to handle the window focus.
@asticode I think this is the way to go: https://docs.microsoft.com/en-us/windows/win32/shell/appids?redirectedfrom=MSDN
not sure how to implement it yet
and when the original app didn't request the single instance it won't affect the original app
So what worked for me was to make a standalone electron app (using electron-forge) and adding the compiled go-app as a dependency.
Then I've added the astilectron nodejs code to the electron app and added a section of code that spawns the go app and have this communication.
This allowed the use of all the build tools in the electron echo system and having my electron.exe be the main executable and it seems that this is the preferred way for windows.
I try add the following on it
const os = require('os')
// ...
function onReady() {
if (os.platform() === 'win32') {
app.setAppUserModelId("https://www.xxx.com/") // ❗ Set it before calling "setJumpList." Otherwise, the "setJumpList" doesn't work.
app.setJumpList([{
type: "custom", name: "My Custom",
items: [
{
type: "task",
title: "Title",
description: "Description",
program: "C:\\Program Files (x86)/Notepad++/notepad++.exe",
}, {
type: "task",
title: "Long Title",
iconPath: "C:\\Program Files (x86)/Notepad++/updater/updater.ico",
iconIndex: 0, // if ommit then you will get 'Argument must be null or an array of categories.'
description: "Description MUST < 256!!!!!",
program: process.execPath
}
]
},
{ // has a name so `type` is assumed to be "custom"
name: 'Tools',
items: [
{
type: 'task',
title: 'Tool A',
program: process.execPath,
args: '--run-tool-a',
icon: process.execPath,
iconIndex: 0,
description: 'Runs Tool A'
}, {
type: 'task',
title: 'Tool B',
program: process.execPath,
args: '--run-tool-b',
icon: process.execPath,
iconIndex: 0,
description: 'Runs Tool B'
}]
},
{type: 'frequent'},
{ // has no name and no type so `type` is assumed to be "tasks"
items: [{
type: 'task',
title: 'New Project',
program: process.execPath,
args: '--new-project',
description: 'Create a new project.'
}, {type: 'separator'}, {
type: 'task',
title: 'Recover Project',
program: process.execPath,
args: '--recover-project',
description: 'Recover Project'
}]
}])
}
output
The above code can achieve the part of the red box, but unfortunately, it is not clear how the blue arrow items should be replaced. 🤔
where default_app.asar
on the
ElectronDirectory()/resources/default_app.asar
for example
%appdata%/appName/vendor/electron-windows-amd64/resources/default_app.asar