mkiol / GNotifier

Thunderbird add-on that replaces built-in notifications with the OS native notifications
https://addons.mozilla.org/thunderbird/addon/gnotifier/
GNU General Public License v3.0
164 stars 25 forks source link

Added support for Windows 8+ #46

Closed kabili207 closed 9 years ago

kabili207 commented 9 years ago

I've based my implementation on @makotokato's notification add-on](https://github.com/makotokato/toastnotification). The notifications had to done in a C++ shim DLL because the Windows 8 notification API is needlessly complex and requires a lot of COM calls. This source has been included under the win8_shim directory. I had to update @makotokato's original code to support images in the notifications.

I also had to set "unpack = true" in the install.rdf and package.json so js-ctypes could read the DLL. I also and upped the MaxVersion to 35, since that's what I had on my windows box.

screenshot 15 screenshot 14

mkiol commented 9 years ago

Windows 8? I would never expect that my "Linux project" will turn in this direction, but why not :-). I'm excited to try it out. Thank you for work you done.

mkiol commented 9 years ago

I have a problem with making add-on workable on Win8. On Browser Console I got this error:

fileName:"resource://gre/modules/addons/XPIProvider.jsm ->
file:///C:/Users/mkiol/AppData/Roaming/Mozilla/Firefox/Profiles/6aj1o=
5k7.default/extensions/jid1-OoNOA6XBjznvLQ@jetpack/bootstrap.js
-> resource://gre/modules/commonjs/toolkit/loader.js ->
resource://jid1-oonoa6xbjznvlq-at-jetpack/gnotifier/lib/windows.js"
lineNumber:16
message:"couldn't open library
C:\Users\mkiol\AppData\Roaming\Mozilla\Firefox\Profiles\6aj1o5k7.defa=
ult\extensions\jid1-OoNOA6XBjznvLQ@jetpack\resources\gnotifier\data\Toast=
Notification.dll"
stack:"@resource://jid1-oonoa6xbjznvlq-at-jetpack/gnotifier/lib/windows.j=
s:16:16
CuddlefishLoader/options<.load@resource://gre/modules/commonjs/sdk/loader=
/cuddlefish.js:129:18
@resource://jid1-oonoa6xbjznvlq-at-jetpack/gnotifier/lib/main.js:67:18
CuddlefishLoader/options<.load@resource://gre/modules/commonjs/sdk/loader=
/cuddlefish.js:129:18
run@resource://gre/modules/commonjs/sdk/addon/runner.js:145:19
startup/</<@resource://gre/modules/commonjs/sdk/addon/runner.js:86:7
Handler.prototype.process@resource://gre/modules/Promise-backend.js:865:2=
3
this.PromiseWalker.walkerLoop@resource://gre/modules/Promise-backend.js:7=
44:7
"
toString:Loader/load/<.toString.value()
__proto__:Error
'''

I'm guessing that for some reason ToastNotification.dll can not be loaded.

My environment is:

Do you have any clue what could be wrong?

kabili207 commented 9 years ago

Figured out what was causing it. It had a dependency on the Microsoft C Runtime which, as of Windows 8, is no longer installed by default. I've made a few slight changes to the library and had it linked statically. Got it working on a fresh Win 8.1 install using the ISO you linked. The DLLs are about five times larger though.

I'll update the pull request at some point tomorrow. I've found an odd issue with Firefox being pulled to focus occasionally, which can get pretty annoying.

kabili207 commented 9 years ago

Turns out I had the click and close handlers mixed up. Let me know if something doesn't work for you.

mkiol commented 9 years ago

It works and it looks amazing!

mkiol commented 9 years ago

Just for your information, updated add-on with Win8+ support is available on AMO.

kabili207 commented 9 years ago

Awesome!

As a side note, the description on the add-on page seems to undersell gnotifier's features a bit. It makes no mention of OSX support nor the fact that it also works with the HTML5 notification API.

mkiol commented 9 years ago

True that.. apparently I'm not good in advertising :/

Regarding OSX, so from FF 28 there is build-in integration with OSX notification center, so GNotifier is not really needed. I suspect sooner or later Mozillans are going to fix integration with Linux and Window as well...

kabili207 commented 9 years ago

Based on this bug at mozilla we could expect native support very soon. The biggest difference is that some linux distros tend to take a while to update to the newest version. Gentoo, my distro of choice, for example, only has only recently marked FF 31 as stable.

GNotifier will still be very relevant for quite a while, if only on distros that don't always run the latest-and-greatest version of Firefox.

ghost commented 9 years ago

Definitely still useful for people using ESR versions of Firefox, or forks based on that (like IceCat).

mkiol commented 9 years ago

@kabili207 Please take a look at #50. Do you have any clue what could be wrong? I don't see anything alarming on debug console, but Firefox gets frozen.

mkiol commented 9 years ago

Just for your information. Find below statistics for Windows. Latest value is 1235 active users.

win365

kabili207 commented 9 years ago

That's a lot more windows users than I was expecting.