-
-
Notifications
You must be signed in to change notification settings - Fork 560
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
Tray icon Fix #2109
Tray icon Fix #2109
Conversation
This didn't fix the issue. How could I show the logs? Electron 24.8.6 |
Hi @devCKVargas. Just to be sure, are you using caprine from https://github.com/stkrknds/caprine/tree/tray-icon ? |
For me, this didn't fix the issue with CPU usage and I still had to put The status tray icon still didn't change when I have an unread notification and it still showed elevated usage.
|
Unfortunately, still broken. |
Thanks for your comments. To be honest, I have no idea why it is not working for you.. Changed the selector again, could you please check if it works now. Again, thanks a lot for your time. |
Are you talking about the Chat icon in the Messenger App sidebar? OR the Chat Icon in the Systray/XFCE panel? |
Caprine uses the Chats icon in Messenger's sidebar to update the tray icon. |
The tray icon doesn't work, but the Messenger icon does. |
@sgtcoder Could you provide the class name of the Chats icon? You can do that by first, opening the console(pressing F12). Then Ctrl+Shift+C and click on the "Chats" icon. The element we want is the one with the aria-label attribute. |
|
looks like there is a slight difference in the one in your code change. So you guys have to do this like everytime Facebook pushes a new update out? |
Not saying it's a good idea, but it's not like Facebook labels ids on these, can you just do first span > a? Or pull it from the aria-label, would just have to somehow wildcard after the "Chats" |
Yes, unfortunately. |
Tried to do something similar with the previous commits as it is harder to break, but that still didn't work for you, while it worked for me. |
MWCMInboxLeftRailSidebar class doesn't exist for me. Let me see if I can find something that will work, now that I know what this is for. That's crazy you guys have to do this all the time. |
Something like this
but I am trying to figure out why that doesn't work. |
It's better to avoid using aria-label in a selector, because it will not work for every language. |
Good point on that, didn't realize. OMG, I got it to work with updating the class. And no crazy CPU usage. Now let me see if I can get it more dynamic. |
This works too, it's not too terrible. |
Notification alerts are coming in now too. I noticed that the Messenger settings, etc aren't working either. |
It doesn't work when the sidebar is expanded. I would suggest to modify this selector |
This is related to #2108 |
Gotcha. Still working on it, but role navigation isn't quite unique |
Okay.. I modified the selector that you found, in order to work with the expanded sidebar as well. Can you test if it works on your end? |
Yes, I saw your commit and that worked. Should we do nth selector on that a tag? Either one works though.
|
Doesn't really matter. It picks the first one that it finds regardless. I think we can leave like this for now. Thanks for your help. |
I think also it wouldn't be bad to update some of the packages in package.json. I have a list of ones that can be updated without noticing any breaking. Or at least element-ready since if notifications break again at least the CPU won't cook. |
Ahh, I see, wasn't sure how that was connected in the Electron app. Thanks for clarifying and you are welcome. Let me know if you need anything else. I am a web developer/programmer as well. Caprine is great on my build so I don't have to pull out the phone. |
https://github.com/sgtcoder/caprine/releases/tag/v2.59.3 Here is a working version from my FORKED version with all the package dependencies updated that could be updated, with the Tray icon fix and the hidden dialog fix as well. Seems to be working well for me, I will continue to test/use. |
Awesome. Thank you. It has been 4 months since the last PR was merged. |
@hlqviet But keep in mind this is under my forked copy of it. Probably good for a temp solution until main Caprine gets updated. |
There still seems to be some CPU usage while the app is idle but it's much better than before. |
I do agree that there is some usage (quite low, 33 percent on 1 thread). Not as bad as Mailspring, and I wonder if the usage has always been there. Either way, if the Caprine team can point me in the direction of looking at the resource usage of caprine components, I might be able to take a peak. My guess is maybe monitoring of certain things like notifications. Like because you would have to monitor that in the app. Like every second or 5 seconds or something? |
So the other thing is the Marketplace notifications aren't working. Maybe we can pass a 2nd paramater to track this? |
The selector A useful function would be |
It sounds like we want to consider detecting if the sidebar is open or closed and running the specific classes based off of that. That should make it a little more effective. |
Hey guys, have we tried this, it's working on closed and open for me. |
Also, you guys mentioned you only want the chat icon notifications, but I would like the Marketplace as well. |
This change works for the expanded sidebar, but not for the collapsed one, since each
|
Mine is working while collapsed and opened. What are you doing to test while closed and it not working? |
Plus this just grabs the first a tag whether it's in a span or not |
@sgtcoder It's not that the selector doesn't work, but it technically matches all 5 of the categories listed. The selector |
Can you just have it return after the first element selection? It's going to be difficult getting just the first element only and support closed and open states. |
From https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector:
This means that querySelector, as it is now implemented, will always return the chats icon, which is the first matching element(depth-wise). |
Yes, which is exactly what you wanted? Otherwise, we might need to add a MarketPlace Icon entry and listen in on that (or add an option), which is why I just have it listening to the entire sidebar for right now on my fork. My phone is on silent 24/7, so these are important notifications too. |
If you want to do something similar for marketplace messages, I suggest you take a look at how the tray icon works, and in particular the following snippets: caprine/source/browser/conversation-list.ts Line 274 in 91689db
caprine/source/browser/conversation-list.ts Lines 296 to 305 in 91689db
caprine/source/browser/conversation-list.ts Lines 262 to 270 in 91689db
Lines 418 to 421 in 91689db
Lines 102 to 139 in 91689db
I've never used the marketplace, so I can't help any further. I think this feature can be covered in another PR. |
Hi everyone. Sorry for the radio silence, it's not easy at the moment to be present all the time so you'll have to excuse me for that. Regarding the PR. I see that @mquevill has joined in to review it. Seems like most of the issues have been resolved. Is this ready for merging? |
This selector works for now for both expanded and collapsed left sidebar. There's some additional work on other notification numbers, but that will be in another PR for later. |
Thank you everyone for contributing to fixing this issue! Especially @stkrknds for doing the initial work! |
Thank you for sharing this. I will look into this and see what I can put together. |
The tray icon does not change when there are unread messages. This is due to the broken chatsIcon selector.