Background apps design
This is a continuation of the discussion in #153 (closed).
Goals
- Ensure that apps behave in a predictable manner.
- Ensure that application state is transparently reported by the system.
- Avoid apps silently doing stuff in the background, without people realising.
- Focus on user needs: what do people need from the system, in order for their apps to behave as they'd like?
- Don't require people to decide up front whether an app can run in the background: the prompt is generally unwanted, and little understood.
Example apps
These are organised by type:
- "Monitoring"
- Mail clients: Geary, Thunderbird
- Chat apps: Telegram, Polari, Signal, Skype, Slack, etc
- News & social media: NewsFlash, Corebird
- VPN: Cisco AnyConnect, Palo Alto GlobalProtect
- Hardware enablement apps: Boatswain, Solaar
- Sync: Dropbox, Nextcloud
- Ongoing tasks: Web, Files
- Music: Music, Amberol, Spotify
There are other apps which have traditionally used status icons, which are out of scope here. This includes tools and shortcuts like Tomboy, Shutter, Redshift. These could use a status icon/appindicator, but they are intentionally not supported by the recommended APIs.
Relevant art
Windows 11
- Apps can run in the background by default.
- There's a setting to control the behavior, in the app settings. This is labelled "Background Apps Permissions" and is a tri-state: Always / Power optimized / Never .
- You can also view individual app battery usage from the power settings, and disable running in the background from there.
Mac
Background apps don't seem to be a concept here. Apps seem to be able to keep on running without a window. In this case the running dot is shown under the app launcher. Unclear whether the launcher always shows in the dash when the app is running.
Android
- Apps running in the background are rare. Instead, apps typically use push notifications instead.
- There is an "Active apps" pill at the bottom of the quick settings. This opens a window with a list of running apps, and allows you to stop them.
- Apps must show a notification if they are running as a "foreground" service. This notification cannot be dismissed. (Foreground services are those which are noticeable to uses. There are also background services, which are for janitorial background tasks.)
GNOME
Users have to explicitly grant permission to run in the background, using a dialog that pop up. Running in the background can be disabled from the app settings.
Design Options
Require apps which want to run in the background to:
- Show a persistent notification
- Use dedicated APIs for their domain (libcloudproviders, MPRIS)
- Use an API to determine whether they can run in the background
- A combination of the above
Design
Apps have four ways to run without an open window:
- Use the background portal
- Show an ongoing progress indication
- Use MPRIS to show media controls
- Use the status icon / appindicator API
If an app doesn't do one of these things and runs without an open window, it is forced to stop running.
Background portal
- Apps must ask the background portal to be able to run without a window.
- When they use the background portal, apps provide a status string, which they can update to show what they are doing.
- Permission to run in the background is granted by default, but can be revoked by the user.
- Apps are recommended to include a preference for whether they should run in the background or not.
- Apps that run in the background can also request to be auto-started.
- The system app settings include two permissions for apps that run in the background: one for running in the background, and one for auto-starting. Autostarting is dependent on run in the background being turned on.
- Apps that are running in the background are included in an background apps list.
Ongoing progress
This is a new API which allows apps that are continuing to do something to continue to run, even if their windows are closed. Ongoing progress is shown as a special type of notification.
There is no autostart for apps which show ongoing progress.
Do we want to automatically inhibit system shutdown while ongoing progress is taking place?
MPRIS
Apps can run in the background when they are showing system media controls. This implies that, if playback hasn't started and media controls are therefore not being shown, the app should stop when its windows are closed.
Running app indicators
All running apps have a dot below their launcher, including apps that are running in the background. Apps that run in the background are moved to the dash in the first instance. If an app is running and doesn't have a window open, it can be hidden from the running section of the dash, by drag and drop, or from the context menu.
General notes on the design
This design doesn't account for apps which are running in the background to provide search results for a search provider.
Ongoing progress and music have different behaviour when compared with the other types of backround app: here the background running is transient and is based on actions within the app. They don't behave like services. It therefore makes sense to exclude these types of behaviour from the background portal. This allows focusing the background portal purely on the "app as background service" case.
The status icon category is intended to support apps which expect that kind of UI, based on the fact that they target other platforms.