-
-
Notifications
You must be signed in to change notification settings - Fork 51
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
Notifications #679
Notifications #679
Conversation
Sets up the basic infrastructure for running the daemon runnning in the background.
UPDATE: MailSimpleSasl has an empty CamelServiceAuthType has been fixed by #681 |
@davidmhewitt I tried as you suggested in the latest commit. But the notification center still refuses to show the correct app icon. What am I missing here? |
I can't see where you set the application id of the Daemon but I am reading the code on mobile, so I might have missed it. That should be set to the desktop filename, minus |
@davidmhewitt thanks for the hint! Adding the application id nearly fixed it. Strangely I also had to make sure to set That said, I guess this is ready for review 👍 |
Thinking about this a bit more however... How well does this work when you consider Flatpak? I know we're not shipping this as a Flatpak right now, but, does the background portal stuff allow running a separate executable to the main executable, and do all the notifications work properly there? It kind of feels like the Flatpak model would make this more complicated than just having the main executable send notifications, but I don't know enough to say for sure. |
It sounds like at the very least that your desktop filename needs to be |
@davidmhewitt I'm not sure how this is supposed to work as Flatpack tbh. But I've seen @Marukesu's pull request for Calendar which introduces support for Flatpack using the background portal: elementary/calendar#681 Therefore I assumed I can solve it the same way and simply start with the daemon approach because Mail is not Flatpacked atm. So we can ship now and extend/rework later. |
So there should be two For Flatpak, the background portal is responsible for generating the autostart one (what elementary/calendar#681 does), but we still need to export a second .desktop file for the notifications server, unless we go the one binary/application route. |
One is stored in /etc/xdg/autostart/io.elementary.mail-daemon.desktop and ensures the daemon gets started upon session start automatically. The other one is stored in /usr/share/applications/io.elementary.mail-daemon.desktop and makes sure the user sees the correct application icon in Notification Center as well the notification opens io.elementary.mail when the user clicks on it.
@Marukesu thanks for the clarification. Now this makes a whole lot more sense. I adjusted this PR so it does generate two desktop files for the daemon as you described. We can surely refactor once we start packaging Mail for Flatpack. |
|
Otherwise the application crashes.
UPDATE: I was able to fix the double-entry issue in This also means we can simply start the background task now with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can confirm this works, but I imagine we don't want to shoot off like 20 notifications at a time 😅
Could we count up the messages and senders and if we have more than one new message do something like "10 new messages from 3 senders"?
@danrabbit made the notification a bit more intelligent and therefore less intrusive. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome that's much better! I just have one question about multiple accounts
I'm still getting 2 notifications on startup. I wonder if that's because it's per mail account? That's a good thing imo, but maybe we can call that out more clearly in the notification?
I'm not sure exactly how best to split up the information onto the two lines we have. Maybe @cassidyjames has thoughts? But something like
5 new messages
from 3 senders for [email protected]
not sure exactly how to make that work for the individual emails. Maybe it's less necessary because you have the full context of the sender and subject?
Exactly: The event is emitted once for each inbox folder - so its run once per mail account. I agree, its probably a good idea to also add the display name of this account to the notification. Most probably this would be a good thing to add in the title. I played a bit with it and ended up with the following, what do you think? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, this is a pretty big feature and it seems to work as expected, so let's get it merged and make sure it's well tested for a release at the end of the month!
Nice work :D
This PR fixes #635 with a background service which notifies about new mails received.
Stuff which still need to be addressed before this can be merged:
The- this was because the folder returned fromfolder_changed
signal is not emittedCamel.Store.get_inbox_folder
is not a "real" folder. So we need to get the real one withCamel.Store.get_folder (inbox_folder.full_name...)
Execute the following to run and test the current code: