docs: app.setBadgeCount
This commit is contained in:
parent
cb00d3cfb3
commit
f8ec377123
1 changed files with 21 additions and 25 deletions
|
@ -577,6 +577,26 @@ Disables hardware acceleration for current app.
|
|||
|
||||
This method can only be called before app is ready.
|
||||
|
||||
### `app.setBadgeCount(count)` _Linux_ _macOS_
|
||||
|
||||
* `count` Integer
|
||||
|
||||
Sets the counter badge for current app. Setting the count to `0` will hide the
|
||||
badge.
|
||||
|
||||
On macOS it shows on the dock icon. On Linux it only works for Unity launcher,
|
||||
|
||||
**Note:** Unity launcher requires the exsistence of `.desktop` file to work, for
|
||||
more please read [Desktop Environment Integration][unity-requiremnt]
|
||||
|
||||
### `app.getBadgeCount()` _Linux_ _macOS_
|
||||
|
||||
Returns the current value displayed in the counter badge.
|
||||
|
||||
### `app.isUnityRunning()` _Linux_
|
||||
|
||||
Returns whether current desktop environment is Unity launcher.
|
||||
|
||||
### `app.commandLine.appendSwitch(switch[, value])`
|
||||
|
||||
Append a switch (with optional `value`) to Chromium's command line.
|
||||
|
@ -647,31 +667,6 @@ Sets the application's [dock menu][dock-menu].
|
|||
|
||||
Sets the `image` associated with this dock icon.
|
||||
|
||||
### `app.launcher.setBadgeCount(count)` _Linux_
|
||||
* `count` Integer
|
||||
|
||||
Sets the number to be displayed next to the app icon in the Unity launcher.
|
||||
Setting the count to `0` will hide the badge.
|
||||
|
||||
**Note:** This feature is currently only supported on Ubuntu Unity. Calling this function has no effect when the application is running in a different environment.
|
||||
|
||||
**Note:** You need to specify the .desktop file name to the `desktopName` field in package.json. By default, it will assume `app.getName().desktop` in packaged apps.
|
||||
|
||||
### `app.launcher.getBadgeCount()` _Linux_
|
||||
|
||||
Returns the current value displayed in the counter badge next to the launcher icon.
|
||||
|
||||
**Note:** As `setBadgeCount` only supports Ubuntu Unity, the value will be 0 when the application is running in a different environment.
|
||||
|
||||
### `app.launcher.isUnityRunning()` _Linux_
|
||||
|
||||
This method checks if the current desktop environment is Unity and returns `true` in this case.
|
||||
|
||||
### `app.launcher.isCounterBadgeAvailable()` _Linux_
|
||||
|
||||
This method checks if the current desktop environment supports an app icon counter badge and returns `true` in this case.
|
||||
|
||||
|
||||
[dock-menu]:https://developer.apple.com/library/mac/documentation/Carbon/Conceptual/customizing_docktile/concepts/dockconcepts.html#//apple_ref/doc/uid/TP30000986-CH2-TPXREF103
|
||||
[tasks]:http://msdn.microsoft.com/en-us/library/windows/desktop/dd378460(v=vs.85).aspx#tasks
|
||||
[app-user-model-id]: https://msdn.microsoft.com/en-us/library/windows/desktop/dd378459(v=vs.85).aspx
|
||||
|
@ -679,3 +674,4 @@ This method checks if the current desktop environment supports an app icon count
|
|||
[LSCopyDefaultHandlerForURLScheme]: https://developer.apple.com/library/mac/documentation/Carbon/Reference/LaunchServicesReference/#//apple_ref/c/func/LSCopyDefaultHandlerForURLScheme
|
||||
[handoff]: https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Handoff/HandoffFundamentals/HandoffFundamentals.html
|
||||
[activity-type]: https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSUserActivity_Class/index.html#//apple_ref/occ/instp/NSUserActivity/activityType
|
||||
[unity-requiremnt]: ../tutorial/desktop-environment-integration.md#unity-launcher-shortcuts-linux
|
||||
|
|
Loading…
Reference in a new issue