-
Notifications
You must be signed in to change notification settings - Fork 184
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
Add a very basic Windows notification service. #160
Conversation
Spawns an icon and "balloontip" in the notification area. There are limitations to this method (see the powershell script file), but it meets my needs. Python script that calls the powershell script using python's subprocess module. There may be a better way to do this, but it works so far! Includes an MQTT icon from mqtt.org that is used for the notification area icon. Includes two example screenshots of the end result while using - an ideal, and an example of what happens if there are too many messages (lots of icons you can not read the message from).
Hi Mach, thanks for your contribution. Unfortunately I am unable to test as all my servers are Debian based. However I do use the following for Windows/client notifications from mqttwarn (https://chrome.google.com/webstore/detail/mqtt2chrome/jfcmchhmjkddfoekjbkljcfpdjnpailh?hl=en) which I thought you might be interested in. It obviously requires you to run Chrome as your browser tho. I personally would not want a notification service that required every notification to be clicked/mouse-overed, especially since I use mqttwarn extensively for home automation notifications! |
Yes, it's certainly not an ideal general Windows notification service. I wrote it as a quick way to get limited functionality that doesn't seem to otherwise exist without many heavy dependencies. So it meets my needs - others, maybe not so much, depending on what they're looking for. I was (still am, really) looking for an equivalent to dunst (lightweight notification daemon) but on Windows. Writing this plugin looked like the quickest way to get the functionality I wanted most. It looks like Windows 8 and onwards have a very cloudy-mobile notifications capability, but I'm still running Windows 7. ETA: Wow. Trying to get mqttwarn running on login, and have it use this plugin? As far as I can tell, impossible. Icons/balloontips don't show up unless there is a visible terminal window, period. Will revisit later, but meanwhile I'm closing this pull request. Sorry! |
@mach327 You've gone to a lot of work with this, which I appreciate, and the idea is pretty good actually even though the implementation suffers from a few issues (I love the screenshot you made of the multiple notification icons ... 😄 ) If you think you can improve on that issue, I'll take this. |
@mach327 thx for the inspiration, just knocked up something in python that will display mqtt messages in the windows. |
Does that suffer from the same limitations as the original code? i.e. needs hover to dismis the icon? |
Currently, on Windows 7, yes. Actually, slightly worse, as the icons persist until the mqtt_notification process disappears. However, it seems to run properly in the background! 😄 I didn't realize there was a win32api module, but not only that - there's a "pythonnet" module! Basically the interface the powershell script was using, but in python, which looks like it should solve the can't-background issue. I think I may have a solution for the hover-to-dismiss issue, too. NotifyIcon objects have a "Visible" property that seems to control whether the icon is in the taskbar. I'm testing now. ETA: Holy cow, it works. I'm going to push to my fork and continue testing before I re-open the pull request, but it looks promising. Does it make sense to only ever have one icon that displays multiple balloontips? One icon per topic? Or have each balloontip spawn a new icon and then clean them up after a timeout? ETA3: I went with a single icon. Problem now is that if it's hovered over, it disappears and I haven't yet figured out how to detect this to spawn a new one, or prevent it from disappearing. ETA4: Persistent icon won't work as a plugin for MQTTWarn, I guess. So my master branch now checks for and deletes old icons every time it makes a new notification. Best method that came to mind. This solves the previous limitations, and seems to work pretty well! Gif below shows it in use. |
Spawns an icon and "balloontip" in the notification area of the Windows desktop.
Includes an MQTT icon from mqtt.org that is used for the notification area icon.
Includes two example screenshots of the end result while using - an ideal, and an example of what
happens if there are too many messages (lots of icons you can not read the message from).