}
void Browser::UnityLauncherSetBadgeCount(int count) {
- current_badge_count_ = count;
- unity::SetDownloadCount(count);
+ if (UnityLauncherAvailable()) {
+ current_badge_count_ = count;
+ unity::SetDownloadCount(count);
+ }
}
int Browser::UnityLauncherGetBadgeCount() {
Sets the `image` associated with this dock icon.
-### `app.unityLauncher.setBadgeCount(count)` _Ubuntu Unity_
+### `app.launcher.setBadgeCount(count)` _Linux_
* `count` Integer
Sets the number to be displayed next to the app icon in the unity launcher.
Setting count to `0` will hide the badge.
-### `app.unityLauncher.getBadgeCount(count)` _Ubuntu Unity_
+**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(count)` _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.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
}
}
-if (process.platform === 'linux' && bindings.unityLauncherAvailable()) {
- app.unityLauncher = {
+if (process.platform === 'linux') {
+ app.launcher = {
setBadgeCount: bindings.unityLauncherSetBadgeCount,
- getBadgeCount: bindings.unityLauncherGetBadgeCount
+ getBadgeCount: bindings.unityLauncherGetBadgeCount,
+ isCounterBadgeAvailable: bindings.unityLauncherAvailable
}
}