go-astilectron
go-astilectron copied to clipboard
Notification must set user model id on win32
I did not find the setappusermodelid api on godoc.
https://electronjs.org/docs/api/app#appsetappusermodelidid-windows
BTW, can we set app id custom like com.mydomain.app
Thanks
@txthinking ok for app.setAppUserModelId(id)
.
But regarding your second question, can you point to the Electron corresponding doc?
Sorry for the unclear description. https://www.electron.build/configuration/configuration#configuration
thanks!
I spent some time and found the solution and shared it with the people who needed it.
I using the astilectron 0.27| astilectron: 0.51.0 | Electron 11.4.3
I can wait for provision to finish downloading and processing all the related files and then modifying index.js
where "index.js" is located on: https://github.com/asticode/go-astilectron/blob/e7796e5/paths.go#L62
if os:windows default path:
%appdata%/[appName]/vendor/astilectron/index.js
// App is ready
function onReady () {
app.setAppUserModelId("com.mydomain.app"); // 👈 Add this line. default: electron.app.Electron.
// Init
const screen = electron.screen
Menu.setApplicationMenu(null)
...
But I think this method is still very bad, I hope that the code can be changed directly in the go🤔
see also
Yeah, I think that an AppUserModelID
should be added in the Options.
I won't have time to work on this anytime soon, but if someone is looking to contribute, feel free to let me know and I'll guide you to make a PR.
I'm trying to use the event to change the ID,
I with it can add on notificationCreate
but it doesn't work. It seems that the event has to be determined after the end of onReady. Even if the hard coding can't change the ID later, for example
rl.on('line', function(line){
app.setAppUserModelId("hello world") // 👈 still not work.
// Parse the JSON
let json = JSON.parse(line)
// Switch on event name
let window;
I don't know if my inference is wrong or not, but the result of my experiment is indeed like this.
I noticed that atilectron is not a big repository, I want to use embedgo1.16 embed in go-astilectron to embed it directly so that there is no need to maintain two repositories, and even in the js directly using text/template, we can set some initialization place to supply the user to write the code directly into the js, will become very flexible.
Would you accept the pull request like it?
-
Indeed, the best would be to add the
AppUserModelID
as an attribute to Options so that it gets set right at the start ofastilectron
-
We can't merge
go-astilectron
andastilectron
since some people are usingastilectron
without go and need this repository to exist independently fromgo-astilectron