Rename the unityLauncher api to launcher and make it available on linux in general. + Document it only works on ubuntu
This commit is contained in:
parent
336a55cb23
commit
e2d389fbd4
3 changed files with 20 additions and 7 deletions
|
@ -60,8 +60,10 @@ bool Browser::UnityLauncherAvailable() {
|
|||
}
|
||||
|
||||
void Browser::UnityLauncherSetBadgeCount(int count) {
|
||||
current_badge_count_ = count;
|
||||
unity::SetDownloadCount(count);
|
||||
if (UnityLauncherAvailable()) {
|
||||
current_badge_count_ = count;
|
||||
unity::SetDownloadCount(count);
|
||||
}
|
||||
}
|
||||
|
||||
int Browser::UnityLauncherGetBadgeCount() {
|
||||
|
|
|
@ -647,16 +647,26 @@ Sets the application's [dock menu][dock-menu].
|
|||
|
||||
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
|
||||
|
|
|
@ -45,10 +45,11 @@ if (process.platform === 'darwin') {
|
|||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue