Add additional method isUnityRunning, fix multiple typos in docs

This commit is contained in:
Jonas Schwabe 2016-06-29 19:23:56 +02:00
parent 8ac205685d
commit 768ff7af5a
2 changed files with 11 additions and 6 deletions

View file

@ -650,19 +650,23 @@ Sets the `image` associated with this dock icon.
### `app.launcher.setBadgeCount(count)` _Linux_ ### `app.launcher.setBadgeCount(count)` _Linux_
* `count` Integer * `count` Integer
Sets the number to be displayed next to the app icon in the unity launcher. Sets the number to be displayed next to the app icon in the Unity launcher.
Setting count to `0` will hide the badge. 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:** 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. **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_ ### `app.launcher.getBadgeCount()` _Linux_
Returns the current value displayed in the counter badge next to the launcher icon. 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. **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_ ### `app.launcher.isCounterBadgeAvailable()` _Linux_
This method checks if the current desktop environment supports an app icon counter badge and returns `true` in this case. This method checks if the current desktop environment supports an app icon counter badge and returns `true` in this case.

View file

@ -49,7 +49,8 @@ if (process.platform === 'linux') {
app.launcher = { app.launcher = {
setBadgeCount: bindings.unityLauncherSetBadgeCount, setBadgeCount: bindings.unityLauncherSetBadgeCount,
getBadgeCount: bindings.unityLauncherGetBadgeCount, getBadgeCount: bindings.unityLauncherGetBadgeCount,
isCounterBadgeAvailable: bindings.unityLauncherAvailable isCounterBadgeAvailable: bindings.unityLauncherAvailable,
isUnityRunning: bindings.unityLauncherAvailable
} }
} }