Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: Expose setAppUserModelID() api for Windows #5347

Open
dobriai opened this issue Oct 7, 2016 · 8 comments
Open

Request: Expose setAppUserModelID() api for Windows #5347

dobriai opened this issue Oct 7, 2016 · 8 comments
Assignees

Comments

@dobriai
Copy link

dobriai commented Oct 7, 2016

This is a Windows-specific request.

Groping of application icons in the Windows Task Bar is controlled by the AppUserModelID. We need to be able to set it explicitly in various cases - as icon grouping requirements demand.

I suppose one can just write some GYP and expose the API this way, but this looks like something that framework should provide out of the box.

Thanks!

@ghostoy
Copy link
Member

ghostoy commented Oct 10, 2016

@dobriai Could you show a sample of how you want to use this API?

@dobriai
Copy link
Author

dobriai commented Oct 10, 2016

@ghostoy, I ... am not sure. My assumption was that somewhere, e.g. in window.onload() or some such, I'd just call gui.App.setAppUserModelID(some_string). I'd have to figure out what to use for a string for each specific case.

Is this too vague of an answer? If so, what more specifically do you want to see?

@ghostoy
Copy link
Member

ghostoy commented Oct 12, 2016

@dobriai Currently AUMID (App User Model ID) all windows within an app is set to '_crx_' + chrome.runtime.id by default. It's not documented, but it's implemented such. So they should be stacked in in one icon on taskbar. Could you post a sample app that's not?

@dobriai
Copy link
Author

dobriai commented Oct 13, 2016

OK. I'll try to provide examples as soon as I get some time.

BTW, What is 'crx'?

@ghostoy
Copy link
Member

ghostoy commented Oct 13, 2016

crx is short for Chrome Extension.

@dobriai
Copy link
Author

dobriai commented Oct 14, 2016

OK, maybe I should have made this clear from the very start - now I realize!

Here is the case: Prepare a directory with a trivial "Hello world!" example and in it start two nw.exe processes using different --user-data-dir arguments, e.g.:

/e/GitHub/appusermodelid/d1 > tree -dL 1
.
├── src
├── udir1
└── udir2

/e/GitHub/appusermodelid/d1 > /c/bin/nwjs-sdk-v0.18.0-win-x64/nw.exe --user-data-dir=udir1 src &
[2] 9212
/e/GitHub/appusermodelid/d1 > /c/bin/nwjs-sdk-v0.18.0-win-x64/nw.exe --user-data-dir=udir2 src &
[3] 28932

At that point the two processes' taskbar icons will not be grouped. Which I agree, may be the correct default behavior - i.e. this is desirable for many/most cases. But, there are situations in which one might want to have the two processes be treated as the same "group of windows" in the task bar.

Does the above make it clear?

Then, I am not even 100% sure that a setAppUserModelID() will do the trick I am after. It could be too late by the time the app starts?! I don't know. I suppose I can mock up something to test it...

@ghostoy
Copy link
Member

ghostoy commented Oct 18, 2016

AUMID (App User Model ID) could be per window or per process according to MSDN. NW.js used a multi-process model like Chromium. So if you want to set AUMID in pre process way, you have to call the API before showing any windows owned by the process. Therefore I prefer to implement in the per window way, so that developers won't need to know which process owned this window and you can set AUMID anytime.

The API implementation is included in PR #5374. With this patch, you can set AUMID via package.json, nw.Window.open(), nw.App.setDefaultAppUserModelID() and win.setAppUserModelID().

@ogimenezb
Copy link

Any news on this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants