From 768ff7af5afb18a53479c6b0be32f01c0316a1c0 Mon Sep 17 00:00:00 2001 From: Jonas Schwabe Date: Wed, 29 Jun 2016 19:23:56 +0200 Subject: [PATCH] Add additional method isUnityRunning, fix multiple typos in docs --- docs/api/app.md | 14 +++++++++----- lib/browser/api/app.js | 3 ++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/docs/api/app.md b/docs/api/app.md index da14a504451..260e64533b1 100644 --- a/docs/api/app.md +++ b/docs/api/app.md @@ -650,19 +650,23 @@ 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 count to `0` will hide the badge. +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:** 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. **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. diff --git a/lib/browser/api/app.js b/lib/browser/api/app.js index 466d2dd791c..0ea788b94a7 100644 --- a/lib/browser/api/app.js +++ b/lib/browser/api/app.js @@ -49,7 +49,8 @@ if (process.platform === 'linux') { app.launcher = { setBadgeCount: bindings.unityLauncherSetBadgeCount, getBadgeCount: bindings.unityLauncherGetBadgeCount, - isCounterBadgeAvailable: bindings.unityLauncherAvailable + isCounterBadgeAvailable: bindings.unityLauncherAvailable, + isUnityRunning: bindings.unityLauncherAvailable } }