diff --git a/docs/References/App.md b/docs/References/App.md index e21e65952e..16aa85c142 100644 --- a/docs/References/App.md +++ b/docs/References/App.md @@ -172,6 +172,21 @@ Unregisters a global keyboard shortcut. See [Shortcut](Shortcut.md) for more information. +## App.getDefaultAppUserModelID() (Windows) + +* Returns `{String}` the default application wide AUMID. + +Get the default application wide AUMID (App User Model ID). See also [`app_user_model_id`](Manifest Format.md#app_user_model_id-windows) field in Manifest Format. + +## App.setDefaultAppUserModelID(app_id) (Windows) + +* `app_id` `{String}` the default application wide AUMID. + +Overwrite the default application wide AUMID (App User Model ID) for newly opened windows. See also [`app_user_model_id`](Manifest Format.md#app_user_model_id-windows) field in Manifest Format. + +!!! warning "No Change for Previous Opened Windows" + This API will only affect the newly opened windows. It will **NOT** change the AUMID for previous opened windows. To change them, you need to iterate all windows and call [`win.setAppUserModelID(app_id)`](Window.md#winsetappusermodelid-app_id-windows) for each. + ## Event: open(args) * `args` `{String}` the full command line of the program. diff --git a/docs/References/Manifest Format.md b/docs/References/Manifest Format.md index c2ce9fb1ff..9ab85f9968 100644 --- a/docs/References/Manifest Format.md +++ b/docs/References/Manifest Format.md @@ -153,6 +153,16 @@ These certificates are used as additional root certificates for validation, to a * `{Boolean}` whether the default `Edit` menu should be disabled on Mac OS X. The default value is `false`. Only effective on Mac OS X. +### app_user_model_id (Windows) + +* `{String}` Default application wide AUMID ([App User Model ID](https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx)). Only effective on Windows. + +This property is a fallback when [window specific AUMID](#app_user_model_id-windows_1) is not set. + +If this property is not set, NW.js will use a auto generated AUMID. + +This property can be overwritten by [`nw.App.setDefaultAppUserModelID(app_id)`](App.md##appsetdefaultappusermodelidapp_id-windows) at runtime. + ## Window Subfields Most of window subfields are inherited by sub windows opened by `window.open()` or links (``) by default. The exception list of non inherited subfields are as following. They will be set to default value for opened window: @@ -259,6 +269,12 @@ Control the transparency with rgba background value in CSS. Use command line opt There is experimental support for "click-through" on the transparent region: add `--disable-gpu` option to the command line. +### app_user_model_id (Windows) + +* `{String}` window specific AUMID ([App User Model ID](https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx)). Only effective on Windows. + +The AUMID of the window can be changed at runtime by [`win.setAppUserModelID(app_id)`](Window.md#winsetappusermodelidapp_id-windows). + ## WebKit Subfields ### double_tap_to_zoom_enabled diff --git a/docs/References/Window.md b/docs/References/Window.md index eccc88c872..a850ea93fe 100644 --- a/docs/References/Window.md +++ b/docs/References/Window.md @@ -61,6 +61,7 @@ nw.Window.open('https://github.com/nwjs/nw.js', {}, function(new_win) { - `new_instance` `{Boolean}` _Optional_ whether to open a new window in a separate render process. - `inject_js_start` `{String}` _Optional_ the script to be injected before document loaded. See [Manifest format](Manifest Format.md#inject_js_start) - `inject_js_end` `{String}` _Optional_ the script to be injected before document unloaded. See [Manifest format](Manifest Format.md#inject_js_end) + - `app_user_model_id` `{String}` _Optional_ the AUMID (App User Model ID) for the window. See [Manifest format](Manifest Format.md#app_user_model_id-windows) - `id` `{String}` _Optional_ the `id` used to identify the window. This will be used to remember the size and position of the window and restore that geometry when a window with the same id is later opened. [See also the Chrome App documentation](https://developer.chrome.com/apps/app_window#type-CreateWindowOptions) * `callback(win)` `{Function}` _Optional_ callback when with the opened native `Window` object @@ -421,6 +422,16 @@ Execute a piece of JavaScript in the frame. Load and execute the compiled snapshot in the frame. See [Protect JavaScript Source Code with V8 Snapshot](../For Users/Advanced/Protect JavaScript Source Code.md). +## win.setAppUserModelID(app_id) (Windows) + +* `app_id` `{String}` Set AUMID ([App User Model ID](https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx)) for the window. Only effective on Windows 7 or later. + +This method will overwrite the AUMID set in [`package.json`](Manifest Format.md#app_user_model_id-windows_1). + +## win.getAppUserModelID() (Windows) + +* Returns `{String}` of AUMID ([App User Model ID](https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx)) for the window. Only effective on Windows. + ## Event: close The `close` event is a special event that will affect the result of the `Window.close()` function. If developer is listening to the `close` event of a window, the `Window.close()` emit the `close` event without closing the window.