I'm not really a friend of being disturbed by notifications. My #Librem5 does only play sounds on SMS. Anyway...
What I've been thinking of especially since there is some work on the linux system of the #Pinephones Modem is if there wouldn't be a way to implement some service into the modem that does work even when the phone is in suspend mode.
This wouldn't solve the quest of having some service providint push notification, but it would solve the problem first that on the Librem5 and the Pinephone push notifications can't be received while the phone is suspended.
Another way to get this without having to hack on the modem would be to run a service that would actually voice call a phone when it's supposed to get a notification to wake it from suspend. This solution could be illegal in some jurisdication, because you signal something by a call that is not intended to be taken (and thereby charged).
After a wake-up from suspend by whatever dedicated method the linux system could do whatever would be good to get information about the event that initiated the wake-up call/[wake on modem data thingy].
From there whatever happens in linux could evolve. At first on the phone side I thought one would wait for the services defined by the user to connect to their servers and exchange informations. But this could also evolve into some protocol where the phone asks at the wake-up service for the reason for the wake-up and just make sure that it acts upon that information.
Maybe I misunderstood the whole situation and the whole problem, but it's nice that you started the discussion about this topic and I'd love to learn more about other ideas.
@silmathoron@floss.social turned that idea into scripts for #pinephone
@me @thejackimonster @linmob and since pmos is going to support (or already supports?) systemd, one may not even need different versions depending on the platform
@thejackimonster @me @linmob This is the idea but still requires all apps to use a single push provider for this to work well. If all apps handle their own connections, how do you know when you can go back to sleep?
@darkdragon @me @linmob You can just wait for any notifications in the bus to show up. If there are none after a specific delay, go back to sleep.
I wouldn't want to use a centralized approach anyway.
@thejackimonster @me @linmob Which bus do you mean?
@darkdragon @me @linmob I assume dbus is responsible for notifications in some way on the Linux desktop. Haven't looked into it though.
The part on your systems which processes what libnotify or libportal talk to, I suppose.
@thejackimonster @me @linmob How long do you wait? What do you do when there is one?
Also when applications have their own sockets, they don't have a reason to send notifications over dbus.
When you have a central notification handler, this service has the information directly if it received notifications, so it could trigger directly after checking and noticing there haven't been any.
@darkdragon @me @linmob If there's at least one, you don't go back to suspension. You either turn on the screen or blink via notification LED.
How long do you need to wait? I'd argue you only need to wait for Wifi or mobile data to make some connections. 10 seconds is likely enough but in other cases, make it customizable via config and adjust depending on feedback from real usage.
@thejackimonster @me @linmob With people getting a lot of notifications nowadays, this would basically mean the device almost never sleeps as it would wake up and stays awake after the first notification arrived.
@darkdragon @me @linmob No, it wouldn't. You can make your device go to sleep automatically after about a minute.
If you get too many notifications, that's an issue for the applications to solve. For example disable them or restrict/limit them.
@thejackimonster @me @linmob As you need to refresh your TCP connections about once per minute, you can only sleep less then a minute, then waiting a minute means the device can only sleep less than 50% of the time.
@darkdragon @me @linmob It's not the plan to keep TCP connections open. Applications wake up, open a new connection to request for notifications or changes and go back to sleep, disconnecting.
@me @linmob Even though I also don't like to be disturbed all the time, when I unlock my phone, I want to have an up to date overview over notifications. Having to open all applications manually and check for updates is quite annoying. When you have 20 applications polling at a 15 minute interval each, it's still more than one wake-up per minute and takes longer to initiate the connection and authenticate. Having a 1h interval makes you miss things which happened 50 minutes ago.
@me @linmob The whole sleep and wake up situation is even much more complicated. I started a discussion 1.5 years ago at https://gitlab.freedesktop.org/xdg/xdg-specs/-/issues/102 . This can give a slight overview over things one needs to take into account.
@me @linmob I'd like to add another method: You could utilize the rtcwakup call to let the device wake up from suspension every 5 or 10 minutes to retrieve push notifications and automatically go back to suspension if there are no notifications received.
This wouldn't require changes on the modem and it wouldn't require an infrastructure to make wake up calls/SMS. Most downside would be power draw. But I think depending on the interval (could be even higher than 10 minutes), it should be fine.