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

Initial support for 'com.canonical.Unity.LauncherEntry' APIs #590

Closed
wants to merge 12 commits into from

Conversation

azzar1
Copy link
Collaborator

@azzar1 azzar1 commented Sep 5, 2017

Initial support to 'com.canonical.Unity.LauncherEntry' APIs. At the moment it only supports the badge notification. The code can be tested using the following script: http://paste.ubuntu.com/25473314/

visual

appIcons.js Outdated
if (count <= 9999) {
return count.toString();
} else if (count < 10**5) {
let thousands = count / 10**3;
Copy link
Owner

Choose a reason for hiding this comment

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

Quick observation: the 10**x syntax is not supported on gjs version of my system (Debian Stretch, Gnome 3.22). For retrocompatibily -- so far I have been supporting 3.18--3.24 with the same codebase -- better stick to 1ex format form the moment.

launcherAPI.js Outdated
}
},

setDBusName(dbusName) {
Copy link
Owner

Choose a reason for hiding this comment

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

Missing 'function'. Again, it might work in the latest js but it doesn't on my system.

@micheleg
Copy link
Owner

micheleg commented Sep 6, 2017

Hi Andrea, thanks for the PR. I tried to run your code and and found a couple for minor incompatibilities (I left a couple fo comments here). I wasn't able to test the badges with your script because I don't have libunity on my system at the moment... I will try to have a closer look in the next few days.

@azzar1
Copy link
Collaborator Author

azzar1 commented Sep 6, 2017

Fixed thanks.

@azzar1
Copy link
Collaborator Author

azzar1 commented Sep 20, 2017

Any news?

@azzar1
Copy link
Collaborator Author

azzar1 commented Sep 20, 2017

I added support for progress bar too. The design is based on the one of Plank.

@didrocks
Copy link
Collaborator

@micheleg & @franglais125: sorry to bother you with this, but do you have a moment for a review on Andrea's work? This is the last dock modification we would like to have for 17.10, and as you know, the timeline is short (sorry to come late with this) ;) Now that both indicator numbers and progress bar are included, it would be great to have your opinion on this.

If you don't have time, we can cherry-pick on our dock branch for now, still ensuring it goes upstream afterwards, as you prefer :)

appIcons.js Outdated
let [surfaceWidth, surfaceHeight] = area.get_surface_size();
let cr = area.get_context();

iconSize = this.icon.iconSize * scaleFactor;
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing let.

@@ -1636,6 +1668,7 @@ var DockManager = new Lang.Class({
Name: 'DashToDock.DockManager',

_init: function() {
this._remoteModel = new LauncherAPI.LauncherEntryRemoteModel();
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know that it is strictly necessary, but this object is never destroyed.

In Line ~1921 we can add this._remoteModel.destroy();, since the .destroy() method is already available.

@franglais125
Copy link
Contributor

@azzar1 I got this running on 17.10. Nice work! Generally speaking, this is something that will only work in Ubuntu?

Unfortunately I run Debian, and I haven't found the libraries readily available.

@didrocks I will give it some testing (on 17.10) and see if I find problems/improvements. However, it's really up to @micheleg to plan the inclusion/path forward. Cheers!

launcherAPI.js Outdated
Gio.DBus.session.signal_unsubscribe(this._launcher_entry_dbus_signal_id);
}

if (this_._dbus_name_owner_changed_signal_id) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo this_

@azzar1
Copy link
Collaborator Author

azzar1 commented Sep 20, 2017

Fixed.
Regarding the question "Generally speaking, this is something that will only work in Ubuntu?": Unfortunetly there is not a standard for this type of things, but most docks (like plank, etc.) supports the unity-api. It must be considered that using libunity is not compulsory as libunity is just a "wrapper" to easliy implement the required dbus interfaces.

@micheleg
Copy link
Owner

micheleg commented Sep 21, 2017 via email

@azzar1
Copy link
Collaborator Author

azzar1 commented Sep 21, 2017

It does not use ubuntu specific libraries. Everything is based on dbus.

@micheleg
Copy link
Owner

micheleg commented Sep 21, 2017 via email

@franglais125
Copy link
Contributor

@azzar1 Is there a way of easily running the dbus wrapper without installing libunity? I'm not familiar with the code, browsing through the source I found the unity-launcher.vala file, where I think the necessary api's are defined, but I'm not entirely sure.

I'm asking to know how difficult it would be to have this available on other systems.

@azzar1
Copy link
Collaborator Author

azzar1 commented Sep 22, 2017

@franglais125 you need to implement inside the application a dbus server exporting the required interface with the wanted properties. libunity just does this. I don't have any code example but it's not complicated at all.

@micheleg
Copy link
Owner

I had a look at this. Overall I'm ok with it. I really need to rething the code organization ... but this is good enough for now. I've consolidated the history and made few cosmetic changes in the development branch. However, I could not check if this is working properly: I tried to use your script in a Ubuntu Artful virtual machine, but I could't see any notification badge, nor see any error. Any suggestion?

There's a couple of thing missing/tofix that probably do not directly affect the ubuntu side.

  1. Ideally I need a settings to switch on/off the feature. I can add this later.

  2. The way you set he default color of the badge. I'd keep a more agnostic one (maybe red) as a defualt. I think you should tweak it at the ubuntu theme level, rather than hardcode it here.This can be obviously an acceptable shortcut given your schedule.

If you confirm that the branch is indeed working, I'm happy to merge into master.

@franglais125
Copy link
Contributor

franglais125 commented Sep 24, 2017

Here is a small thing to think about. I don't see it as a deal breaker, but still something that can be fixed:

screenshot from 2017-09-24 14-13-03

Perhaps we can toggle the notifications when showing the number overlays?

Edit: something like this: franglais125@2e6e28c

@azzar1
Copy link
Collaborator Author

azzar1 commented Sep 25, 2017

@micheleg The branch is indeed working.

@azzar1
Copy link
Collaborator Author

azzar1 commented Sep 25, 2017

http://paste.ubuntu.com/25615125/ This a simple python script that can be used to test the code. This code does not uset libunity.

},

insertEntryRemote: function(remote) {
if (!remote || this._remoteEntries.includes(remote))
Copy link
Contributor

Choose a reason for hiding this comment

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

@azzar1 I used your new script (thanks!), and got this running on Gnome 3.22.

This line is throwing an error for me, since Debian is still on mozJS 24.

Perhaps we can change includes (which is not supported until mozJS 52) with:

if (!remote || this._remoteEntries.indexOf(remote) !== -1)

},

removeEntryRemote: function(remote) {
if (!remote || !this._remoteEntries.includes(remote))
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here. includes -> indexOf

Copy link
Owner

Choose a reason for hiding this comment

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

Thanks.

@micheleg
Copy link
Owner

I also manage to get the badges to work with your new script. I've merged the branch into master. I've only skipped the commit changing the default colour, which you might want to keep in the ubuntu-branch for the time being.

@micheleg
Copy link
Owner

I've seen you had already merged in the ubuntu branch and made a new release/announcement. Closing this pull request. Thanks for the contribution @azzar1 @didrocks @franglais125!

Reference to the commit in master: [5ef239d..a6fba76]

@didrocks
Copy link
Collaborator

Thanks a lot as usual @micheleg, @franglais125 to have make that easy for ubuntu! I think @azzar1 will help you once we release 17.10 to get the final options and touches done! ;)

@gayanper
Copy link
Contributor

@micheleg Does the ubuntu feature (progress, badges) works on other distributions as well ? like antergos , fedora ?

@azzar1
Copy link
Collaborator Author

azzar1 commented Oct 12, 2017 via email

@ghost
Copy link

ghost commented Feb 12, 2019

man this looks so cool hope some day unity api will be in the aur for use on manjaro and arch

@harry-cpp
Copy link

The only thing missing from here is the urgency I would say (unity_launcher_entry_set_urgent).

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

6 participants