kotelnik / firefox-extension-unity-launcher-api-e10s

Unity LauncherAPI add-on for Firefox, compatible with e10s.
GNU General Public License v3.0
5 stars 1 forks source link

Error: An unexpected error occurred #5

Open JackHack96 opened 7 years ago

JackHack96 commented 7 years ago

I'm on Ubuntu 17.10 with the default Ubuntu Dock, and the extension is not working. The log is not helping either:

postMessage("count=1") postMessage("progress=0.005808434427057752") postMessage error: Error: An unexpected error occurred

What could be wrong?

CaviaPorcellus commented 7 years ago

Yeah, the extension does nothing for me either with Firefox 57 on Ubuntu 16.04.

kotelnik commented 7 years ago

Please try to experiment with this command in terminal:

gdbus emit --session --object-path / --signal com.canonical.Unity.LauncherEntry.Update firefox "{'progress-visible': <'true'>, 'progress': <'0.3'>, 'count-visible': <'true'>, 'count': <'1'>}"

It should show 30% progress with count of "1" for firefox. If that still does not work, please try changing "firefox" to some other running application to see if there is a problem with the application name.

I currently don't have Ubuntu 17.10 in my virtualbox. I plan to install it but it may take a while, so please report your findings :). Thanks!

JackHack96 commented 7 years ago

I've tried the command but it's not working. Not only with Firefox, I've tried with other apps (like Tilix) and it still doesn't work. The strange thing however is that apps like Telegram work without problems...

EDIT: I've found this Python script and in fact it's working: http://paste.ubuntu.com/25615125/

kotelnik commented 7 years ago

OK, thanks! That's helpful. I'll check if there was a change to Unity Launcher API and how Telegram manages to show the progress. Stay tuned :).

JackHack96 commented 7 years ago

Mmmh. I've tried to start Telegram directly with the binary (the .desktop file has been edited with XDG_CURRENT_DESKTOP=Unity, for making the Telegram icon appear good in the tray) and I can't get badges! Now I'll try with Firefox.

EDIT: The XDG_CURRENT_DESKTOP trick did not work with Firefox :-1: I don't believe they changed the APIs, maybe there's something wrong with my setup. I'll try in a VM with a clean install EDIT 2: I've got a fresh Ubuntu 18.04 VM, and it's doesn't work there either :(

kotelnik commented 7 years ago

Thanks for your investigation. I've found the problem - calling low level DBus api doesn't work for Ubuntu, it has to be called with python wrapper for libunity library. Not only that, it also have to run a dedicated GObject.loop to keep the progress and badge visible. Luckily the python code here works: https://wiki.ubuntu.com/Unity/LauncherAPI#Python_Example

I'm just gonna have to change the my code specifically for Ubuntu to make it work. Please wait.

JackHack96 commented 6 years ago

I've made a patched version for Ubuntu 17.10, if you want to try out go in my profile. EDIT: There's currently a tedious memory bug, I'm figuring it out

kotelnik commented 6 years ago

Hi! Thanks for looking into it and sorry for my stall. I've now pushed an update to the python script to a different branch ("unityCompatible"). It is compatible with current version of Firefox Addon, so you only need to replace the python script to try it out.

https://github.com/kotelnik/firefox-extension-unity-launcher-api-e10s/tree/unityCompatible/app-side

...but I'm not satisfied with the current state of this script. I will try to write a better and much simpler version. And I intend to use your idea - send both progress and count in one message (thanks!). But I also try to use runtime.connectNative (in Firefox) to make a persistent connection between app and addon instead of just sending single messages because Unity expects continuously running app that use LauncherAPI interface.

The reason I didn't do it (connectNative) in the first place was that Firefox loose the connection at some point and is not able to reconnect. That problem I'll need to resolve...

JackHack96 commented 6 years ago

Yes, in fact I've also tried to use connectNative, but I've failed (after all, this is the first time I'm dealing with extensions). Thanks for the temporary fix, I'll try it out :)

kotelnik commented 6 years ago

I've prepared a new branch "connectNative" with simplified code. It should work in Plasma 5 (without libunity library) as well as in Unity (tested in Virtualbox in Ubuntu 17.10).

But there is a weird bug I'm unable to resolve. At some point taskbar in Unity stops responding to changes and one has to restart firefox to make it work again (or kill the python3 process). Could you please test it out and confirm this bug? For now I suspect the bug is in Unity.

JackHack96 commented 6 years ago

Uhm, I've run it for 10+ minutes now and successfully completed a download, and for now there are no weird bugs, nor strange error messages in the debug console

kotelnik commented 6 years ago

Thanks for your testing! A new version is out now :).

JackHack96 commented 6 years ago

Now that I've tested it more accurately, there are some random bugs, and I also think Ubuntu Dock has to be blamed, not the add-on (sometime, if I cancel the download, the counter and the progress bar remains, though it indicates 0 download and 0 progress, or sometime the progress bar is not shown). Luckily, these bugs rarely occurs, at least on my setup. Thank you for the release :+1:

CaviaPorcellus commented 6 years ago

Thanks for the update. I tested the new version in Ubuntu 16.04. It works much of the time, though I've encountered some of the same bugs as JackHack96 (e.g. no progress bar being shown sometimes, just the counter).

kotelnik commented 6 years ago

That is what I sometimes experienced as well. For now I also think Ubuntu Dock is to blame. But to make a proper bug report one probably need to write a simple python script to simulate the issue. I'll do that when I have more time :).

kotelnik commented 6 years ago

I've managed to make a simple script and filed a bug report: https://bugs.launchpad.net/ubuntu/+source/gnome-shell-extension-ubuntu-dock/+bug/1741114