API changes for a better notification list?
Currently my notifications list is filled with a lot of useless debris, including:
Clearly, the fact that I had an app crash 4 days ago, performed git push last week, or built a project yesterday, is not interesting. All of these notifications should have never been added to the notification list, or should have been withdrawn at some point in the past.
My sense is that this is happening due to the notification capabilities that we have at the platform level.
Existing APIs
Why have one API, when you can have three?
An incomplete comparison:
Property | Libnotify | GIO / Portal | UX |
---|---|---|---|
Title | ✓ | ✓ | |
Body | ✓ | ✓ | |
Icon | ✓ | ✓ | |
Default action | ✓ | ✓ | |
Button | ✓ | ✓ | |
Priority | ✓ | ✓ | Includes 4 levels. Urgent priority means that the banner doesn't hide by itself. I don't think we do anything with the other priority levels? |
Category | ✓ | ✓ | I don't think we use this on the shell side? |
Expiration timeout | ✓ | ||
Resident | ✓ | According to the spec, this keeps the notification around even after it has been activated. Unclear if we do anything with it. | |
Transient | ✓ | The notification is shown as a banner, but not added to the notification list. | |
Sound | ✓ | Path to a sound file that is played. |
Currently, if using the GIO or portal API, if an app wants to withdraw a notification, it needs to be running and to track the original notification (how to do that is a bit unclear).
Relevant Art
Android
Notifications include:
- App icon
- App name
- Timestamp (optional, added by the app)
- Expand indicator (if it can be expanded)
- Content title
- Content text
- Large icon (optional)
Other optional things they can contain:
- Up to three buttons
- Reply buttons to allow replying to messages
- Progress bars
- Large images or blocks of text - shown as a small thumbnail, which can be expanded
- Conversations
- Media controls
Notification properties:
- Categories - used to determine whether a notification should be shown when do not disurb is on
- Lock screen visibility - to hide potentially sensitive notifications on the lock screen
- High priority and full screen intent - for things like incoming calls. These appear full screen on the lock screen, and as a big banner when unlocked.
- Groups: For example, an email app could group all the email received notifications. If an app sends 4 or more notifications without grouping them, then they are automatically grouped.
- Require device to be unlocked for action to be carried out
- Expiration timeouts
- Channels. Notifications must be put in a channel. Each app can have multiple channels, which are exposed in the notification settings. For example, a Clock app could have channels for alarms, timers, stopwatch.
- Channels have an importance, which determines their how noticeable they are:
- urgent: sound + heads up notification
- high: sound
- medium: no sound
- low: no sound, does not appear in status bar
Other capabilities:
- Notifications can be updated and revoked.
- Apps can revoke all their notifications.
- Apps must show a notification when running a "foreground service" - a service that's in the background but somehow noticable to the user
iOS
Notification elements:
- Title
- Subtitle
- Body
- Sound: a custom sound file
- One or more actions
- Custom UI: you can put your own custom UI in a notification, such as a calendar, map, conversation, etc
Notification properties:
- Groups - you can create groups for notifications. If no group is provided, then all the notifications from the app are put in a single group
- Interruption level. "Passive" is equivalent to our transient.
Other capabilities:
- Seems to be possible to withdraw a notification
Potential solutions
Solutions to the immediate issues at hand:
Notification | Solution |
---|---|
Application Updated | Expire after 1 hour |
Build successful | Revoke when app is no longer running, or when the app window is focused |
Oops! | Expire after 1 day |
Command completed | Expire when app is no longer running, or when the app window is focused |
Character copied | Maybe shouldn't be a notification. But if it is, expire after 5 minutes. |
File Operations | Revoke when app is no longer running, or when the app window is focused, and expire after 1 day, just to be sure |
It could be good to make "revoke when app window is focused or app is no longer running" easy. Maybe that could be a notification property that the shell could take care of?