Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ubuntu Unity launcher counter badge #6243

Merged
merged 7 commits into from
Jun 29, 2016
Merged

Conversation

jnugh
Copy link
Contributor

@jnugh jnugh commented Jun 26, 2016

Hi,
I implemented a way to change the unity launcher counter badge from within electron:
Screenshot

For this to work the app needs to be started with env CHROME_DESKTOP=[name of desktop file] or (which I found out about while writing this: set desktopName in package.json the way you would do for making the progressbar work).

Please let me know what you think. When there is something to improve, just let me know. 👷

@anaisbetts
Copy link
Contributor

Maybe assume that the package name is /usr/share/applications/PACKAGE_ID.desktop if it's unset?

@@ -45,6 +45,13 @@ if (process.platform === 'darwin') {
}
}

if (process.platform === 'linux' && bindings.unityLauncherAvailable()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The existence of API should not depend on current environment, if an API is available on one Linux distribution, it should be able to be called on other Linux distributions, even though it may fail.

We can add a app.unityLauncher.isAvailable API to let user decide how to behave on different platforms.

@zcbenz
Copy link
Contributor

zcbenz commented Jun 26, 2016

Maybe assume that the package name is /usr/share/applications/PACKAGE_ID.desktop if it's unset?

That's our current behavior, but it is only working for packaged app for now.

@@ -216,6 +223,8 @@ class Browser : public WindowListObserver {
std::string version_override_;
std::string name_override_;

int current_badge_count_ = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this go behind a #if defined(OS_LINUX) check since those methods are behind that check?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the compiler would remove this as unused, because it is private.
But I will add an ifdef block, to keep the code clean.

@anaisbetts
Copy link
Contributor

@jnugh This is a great PR! Looking forward to it landing, we'll definitely be using this in the Slack app on Linux

describe('app.launcher API', function() {
it('should be available on linux', function() {
if (process.platform !== 'linux') {
assert.equal(app.launcher, undefined);
Copy link
Contributor

@kevinsawicki kevinsawicki Jun 29, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was previously an issue where npm run lint did not properly lint the spec/ folder.

This was fixed in #6289 so if you rebase or merge master into this branch and then run npm run lint, you should see some errors for this file like the ; at the end of this line.

Sorry that this wasn't picked up sooner.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I didn't remember to run the linter...
Rebased, Fixed the errors, squashed it into the specs commit 😄

@kevinsawicki
Copy link
Contributor

Awesome, thanks for this @jnugh 👍

This will be really nice to have on Ubuntu and great job on the docs and tests.

saenzramiro added a commit to ramboxapp/community-edition that referenced this pull request Jul 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants