facelessuser / SubNotify

Sublime Text notification plugin http://facelessuser.github.io/SubNotify/
MIT License
38 stars 1 forks source link

feature_request(app): Snarl support #9

Open Kristinita opened 4 years ago

Kristinita commented 4 years ago

1. Summary

It would be nice, if SubNotify will support Snarl notifications.

2. Argumentation

2.1. Snarl

Snarl is:

  1. Alternative for Growl for Windows (GFW), that have the highest number of likes on AlternativeTo.Net
  2. Open source
  3. Actively developed at April 2020

2.2. Growl for Windows

GFW is no longer maintained since 2012. At April 2020 spamming links in web-pages of GFW site (examples — 1, 2). So I switched to Snarl.

Thanks.

facelessuser commented 4 years ago

This is a good request. I do have some refactoring to do in this plugin that is planned. It would probably be a good idea to look into snarl at that point too. I probably won't have the time in the next couple of weeks, but hopefully I can get to this soon as I've been meaning to do some updates here.

Kristinita commented 4 years ago

This issue is still relevant.

I certainly have no right to force you to do anything, but I thought, what you maybe have forgotten about this issue.

Thanks.

facelessuser commented 4 years ago

@Kristinita, I actually haven't forgotten. I've actually been considering refreshing this package sometime very soon. I recently did some related work over on this project that uses a variation of this library: https://github.com/facelessuser/Rummage/commit/cc94a2fff55980d306821ab2a2b4d663451d8241.

I want to kind of rework this. One thing is for sure, I'll be dropping growl. Adding snarl is definitely still a possibility. There are some things I need to rework here. I imagine within the next month or two I should be able to revisit this project. 🤞

It would be an understatement to say I support too much, but I haven't abandoned this, it just hasn't been the top priority.

facelessuser commented 4 years ago

I haven't looked into the actual code required to support snarl yet. But I wanted to give some insight.

The biggest risk for this issue is me possibly doing what I did over at Rummage and completely eliminate growl support and just sticking to native implementations (or workarounds like terminal-notifier which are used on macs because Apple is strict about what can raise notifications).

Growl for macOS isn't that popular anymore (and frankly is paid and not that good), Growl for linux hasn't been updated in like 4 years, Growl for Windows (as you pointed out) is basically dead. I'm not even sure if the gntp library (which project also hasn't been updated in years) shipped with this library still works. I haven't actively had growl installed on any machine these last couple of years and haven't actually tested that it is still a viable option. In general, I'm not sure there is quite the interest in growl and growl like systems as there once was.

I may end up just sticking with known native implementations (or workarounds like terminal-notifier which are used on macs because Apple is strict about what can raise notifications). This is the greatest risk to this feature request.

While I see the author of snarl has responded more recently in issues, the project itself hasn't been updated in two years...which is kind of funny as this project also hasn't been updated in like two years 😬 . Much like me, the author seems to still have good intentions of updating, hopefully they will keep it alive.

Ultimately, if it is easy enough to implement snarl, then I think I may add it. But if it requires too much effort, it may not make it. I'm currently optimistic that it won't be too bad. I will hopefully make this decision and implement whatever I'm going to by the end of August.

Kristinita commented 4 years ago

Type: Reply 💬

Why this issue is important to me. I use Pomodoro Sublime Text plugin, which depends on SubNotify.

If I use CairoShell:

  1. Native Windows notifications which call by SubNotify doesn't work.
  2. Growl for Windows as you pointed out basically dead.
  3. Snarl not supported by SubNotify.

I believe that Sublime Pomodoro is a nice package, but I need to use alternatives for the above reason.

Thanks.

facelessuser commented 4 years ago

Thanks for giving me more details. I'm willing to at least give it a shot.

I feel cases like CairoShell are kind of outliers, special cases. It's a small percentage of users who use special shells for Windows (once upon a time I did as well). I would argue that CairoShell should support default messages (by redirecting them to Snarl?). How do other apps send messages without having explicit Snarl support? I find it hard to believe a lot of apps are explicitly adding support for Snarl as I'm not sure it's that well known, but maybe 🤷.

Maybe we need to update our native notification approach for Windows? I'm pretty sure there are probably a lot of apps using notifications that do not explicitly use Snarl. Do all of those apps also not have proper notifications? Either way, I'll take a look. I won't be able to test with CairoShell specifically as I'm not currently willing to put a custom shell on my work laptop (my only Windows machine currently -- I'm usually on macOS or Linux) but I can probably at least test through Snarl.

Kristinita commented 4 years ago

Type: Reply 💬

When I use Ferdi, I successfully get notifications, even if I use Ferdi and CairoShell both. Ferdi seems to be using native Windows taskbar notifications.

Thanks.

facelessuser commented 4 years ago

Curious. What version of Windows are you using? We are actually calling the user32 lib of Windows to raise notifications (when using the native implementation). I wonder what Ferdi is doing. I know it is an Electron app, so using a chrome webrowser framework.

To be honest, it sounds like a weird corner case inside of CairoShell. It sounds like solving your issues may be better served by figuring out why native isn't working under CairoShell...ugh, that'd mean I'd have to experiment with CairoShell.

Maybe I can play with CarioShell over the weekend and see if I can identify what in our current implementation isn't working under CairoShell. If there is a different/newer/better way to raise notifications that others use.

facelessuser commented 4 years ago

I figure if we can get native to work reliably, it may make the need for snarl moot.

facelessuser commented 4 years ago

So, I have verified the CairoShell issue exists installing and enabling CairoShell long enough to verify. One thing I've noticed is that the type of notifications we do in Windows don't appear in the notifications panel on Windows. I imagine Cairo intercepts those, but not the ones implemented the way we are doing it. So, maybe there is a more modern way we can raise notifications that appears in their notification panel that would also be recognized by Cairo. I'll look into that first. I can do that outside of CairoShell, and then test inside CairoShell to be sure that solves the issue.

If native ends up working, we may not explicitly need Snarl.

facelessuser commented 4 years ago

Hmm. I've tried every permutation of Python libraries using toast notifications, and am yet to find a single one that works in Cairo. I suspect that there is a bug in Cairo in regards to notifications. I don't think there is anything we are doing wrong. I would potentially look into creating an issue at CairoShell. They could use this to test the inability of notifications to show up: https://github.com/jithurjacob/Windows-10-Toast-Notifications. That library basically does what we are doing with win32gui whereas we just use ctypes.

I'll leave looking into Snarl as an option though. It is an extensive workaround when native should work, but I'll at least look into it.

facelessuser commented 4 years ago

On a side note, I did figure out how to replace the icon in toast notifications, which previously were just stock icons from windows. I also figured out how to get rid of the weird windows.explorer.notification {unique-id} thing. We were hiding the taskbar icon (well more destroying it actually) once the message was posted as the icon is pretty pointless, but it is necessary for the toast notifications to work. With no parent taskbar icon, Windows wants to display the notification's origin (mainly so people can't spoof a notification), so since there is no parent, it just mentions explorer.

Basically we have to keep the icon around and then capture the notification event that signals the message was dismissed due to time out (or due to manual dismissal) back in the plugin. Then, and only then, should we destroy the taskbar icon.

Interestingly, this is also why the notifications disappear from the notification panel. They only persist while the parent taskbar icon persists.

If we want notifications to persist in the notification panel, we have to keep the taskbar icon up, which we could do, but if you ever have multiple instances of Sublime, it gets confusing which one goes to which, etc. That's why we destroy them. I really don't care so much if the message persists in the sidebar, but if someone did, we could always consider making the message persistent by keeping the taskbar icon up full time.

None of this helps with CairoShell as it just doesn't want to see these toast notifications 🤷‍♂️ .

facelessuser commented 4 years ago

I've finished reworking most of Windows notification support over in my other project: https://github.com/facelessuser/Rummage/pull/401.

Outside of windows:

In all my rework, I was still unable to get them to work in Cairo. So after I port back the changes here, I will then look into what it would take to get something working in Cairo possibly with Snarl.

facelessuser commented 4 years ago

@gir-bot add T: feature, C: windows, S: maybe

facelessuser commented 4 years ago

@gir-bot add p: maybe

facelessuser commented 4 years ago

Interesting, gir-bot failed to process that request...

@gir-bot add P: maybe

facelessuser commented 4 years ago

Must have been a race condition...

facelessuser commented 4 years ago

Okay, SubNotify has been fully updated to the latest library. So when I get a chance, I'll look into Snarl. It's the last issue before I roll a new release.

facelessuser commented 4 years ago

It seems this may be our best bet to send snarl notifications: https://github.com/fullphat/snarl_network_protocol/blob/master/clients/generic/snp31send/1.1/snp31send.py.

Untested, but wanted to log this info as I think I'm done researching this for today.

facelessuser commented 4 years ago

So far Snarl support is not looking too great. The documentation to use Snarl is quite poor. The script I linked to earlier is only for Python2 (which is end of life) and even when you run it in python2 it is unclear what port do we send to? Do we have to run our own server in addition to the actual snarl app that you can download? I am confused as to how we send messages to the snarl app.

I have seen that other toast notifications work in Cairo, but they may be using the UWP app method. This seems to be more involved. There are generic toast notification senders like snoretoast that work in Cairo. For instance, node-notifier uses snoretoast and works fine in Cairo.

Unfortunately, all toast notifiers that notify the way we do such notify-send (a Windows version of the Linux app with the same name) do not work.

What does this mean? Personally, I think Cario Shell should figure out how to support these types of notifications. I feel this is more of a bug in Cairo right now than it is SubNotify.

This is unfortunate because while I'd like to offer an alternative, current alternatives are pretty hard to understand. With that said, we could use something like node-notify or just use snoretoast directly. That would be a much simpler alternative than going down the route of Snarl. While I'm sure it works great if you know what you are doing, the entry bar right now is too high for me to spend time on it.

facelessuser commented 4 years ago

I'm not going to hold up the current release for this right now. I'm going to get the current version out. It is unfortunate, but Snarl is not easy to just pick up and run with. I just don't have time to dig into this further right now. I wish it was more approachable to get going.

In all honesty, I think CairoShell needs to fix it so all notifications show. I feel this is an issue on their part that we are trying to work around when we shouldn't have to.

Kristinita commented 3 years ago

Type: Replies 💬

1. Snarl alternatives

This is unfortunate because while I'd like to offer an alternative, current alternatives are pretty hard to understand. With that said, we could use something like node-notify or just use snoretoast directly.

I have no objection node-notify, snoretoast or any another open source software. The main thing that SubNotify works in CairoShell. Right now, unfortunately, SubNotify doesn’t work for me.

2. CairoShell issue

I can post an issue about this problem to the CairoShell issue tracker. Or will you (you can provide more technical details)?

Currently, if I use CairoShell, I successfully get notifications from:

  1. Ferdi,
  2. grunt-notify Grunt plugin,
  3. Video DownloadHelper Chromium plugin.

But not from SubNotify.

Thanks.

facelessuser commented 3 years ago

Or will you (you can provide more technical details)?

I'll let you post one as this is not really something that I am invested in. I'd link them to projects like jithurjacob/Windows-10-Toast-Notifications that do not work under Cairo Shell. They can use that to test. I don't know the technical reasons why this method of creating notifications doesn't work, I'd let them look into it.

I have no objection node-notify, snoretoast or any another open source software. The main thing that SubNotify works in CairoShell. Right now, unfortunately, SubNotify doesn’t work for me.

I'll consider it.