facelessuser/SubNotify

bug(notifications): notifications disabled a few days later

Kristinita opened this issue · 7 comments

1. Summary

Sometimes Windows notifications disabled for me.

Only Windows restart helped for me.

2. Environment

  • Windows 10 Enterprise LTSB 64-bit EN
  • default Windows notifications, not Growl or Snarl
  • Sublime Text Build 3143
  • Pomodoro v2017.12.17.08.22.00
  • SubNotify 1.4.3
  • Grunt 1.0.2
  • grunt-notify 0.4.5

3. Configuration

All notification enabled for me in Windows settings:

Notifications enabled

4. Details

I use notifications from:

Once a 1—4 days, I stop receiving notifications. Sublime Text icon appears in my taskbar and doesn't disappear.

Sublime Text icon

If left-click or right-click to this icon, nothing occurs. I can't remove this icon from my taskbar.

Now I don't get notifications from Sublime Pomodoro and Grunt Notify.

If I restart Windows, I get notifications again; but 1-4 days later I get same problem.

5. Not helped

I can't find:

  1. how I get more information about my problem in Windows logs and Event Viewer
  2. what do I need, that enable notifications without Windows restart

If you need more debugging information, please, tell me, what can I do yet.

Thanks.

The icon appearing and not disappearing may be related to some missing cleanup. It will disappear when you close Sublime (once closed sometimes you need to mouse over it for Windows to redraw the taskbar without it). Cleaning up the icon is something I can look into.

I'll try and see if I notice it disappearing for me. I'll also check if I have some fixes I haven't ported over from https://github.com/facelessuser/Rummage (which is what I originally wrote the notification lib for). I know Rummage doesn't have the persistent icon, so maybe I fixed that issue there, I'll have to check.

@facelessuser ,

The icon appearing and not disappearing may be related to some missing cleanup. It will disappear when you close Sublime (once closed sometimes you need to mouse over it for Windows to redraw the taskbar without it). Cleaning up the icon is something I can look into.

More details:

1. Behavior

I have problem from post above.

I close Sublime Text → icon disappear for me. Notifications from another Windows programs still doesn't work.

I restart Sublime Text → I run Sublime Pomodoro.

When Pomodoro must make a notification, I get only icon in taskbar, not notification. Icon not disappeared, if Sublime Text enabled. Notifications from another Windows programs still doesn't work.

Thanks.

I'm not saying I think the icon disappearing is related to why you aren't getting notifications. I know that even though the icon is there for me, I still get notifications. So I'm not sure why you aren't getting notifications. I will try to see if I can isolate that, but the icon properly disappearing I can probably address, and maybe if it is cleanup related, maybe notifications stop showing due to leaky objects, I don't know.

In short, I can probably address the icon, but I'm not sure about the missing notifications as I'm not even sure that is caused by SubNotify yet.

I am yet to reproduce the disappearance of notifications, I will most likely have to run some of the plugins you are using to try and reproduce.

What I did find is that on reload of the main module, we don't destroy the existing task window handle before creating a new one. Possibly when a plugin gets updated, this might allow for an exiting object to leak, this is easy to patch. Basically on plugin setup we allocate a task window through which windows notifications are performed. We only need one, so we create it, and use its handle for all future manipulations. But on reload, we will spawn a new one without checking if one already exists and destroying the old one. So this is not ideal. So calling destroy before creating is what Rummage is already doing, and the only thing this plugin is not doing.


As for the icon, we create it as we have to when generating the message through ctypes. What is supposed to happen is that a message gets sent back and triggers an event that hides the icon. I believe this works in Rummage (which this was designed for), but maybe doesn't quite work right when run through plugin_host. But when Sublime is terminated, the window handle gets destroyed along with the icon. The icon only persists after Sublime closes because a window update isn't called to force a redraw, so mousing over the icon causes windows to redraw and the icon disappears.

So, in short, the icon is completely unrelated, but it is also unnecessary once the message is shown. It appears I can immediately delete it without affecting the notification. So I may do that moving forward as we don't seem to get the callback in plugin_host. We only create the icon so we can send the message via ctypes.windll.shell32.Shell_NotifyIconW.


So, lastly, I will have try out Pomodoro and see if there is something introduced here. If grunt-notify is to blame, I will not be able to debug that.

Okay, I've merged recent Windows notify tweaks and I will run with Pomodoro to see if I can reproduce the issue. If I can't reproduce, you should try running without grunt-notify to see if the issue goes away.

@gir-bot add T: bug, c: Windows, S: needs-confirmation

I'm closing this issue as it has been so long, and some things have been reworked, and I was never able to reproduce. It seems you are using a different method now with its own set of issues (Cairo).