Platform services and desktop integration
Teams for Linux places the Teams web client inside an Electron desktop shell. The main process owns actions that need operating-system access, while the Teams renderer uses narrow browser hooks and IPC requests to reach those actions. This boundary supports sign-in, calls, screen sharing, notifications, desktop controls, and optional Microsoft Graph features without giving the web page direct access to native APIs.
System boundary
Main process services
The main process is the trusted coordinator for the desktop shell and its platform services. It creates the Teams window, starts services at app readiness, and connects renderer events to native actions such as notifications, screen capture, power control, menus, and system integration. The renderer remains responsible for the Teams user interface and reports Teams state through the supported bridge.
The boundary has two directions:
| Direction | Role |
|---|---|
| Teams renderer to main process | Request a native action or report a Teams event through an allowed IPC channel. |
| Main process to Teams renderer | Return a result or notify the page about native state. |
| Main process to operating system | Use Electron, D-Bus, or child processes for a user-approved desktop action. |
The main process also owns application-wide state such as the current user status, active calls, profiles, and session partitions. This lets several desktop surfaces use the same state without giving each surface a separate path to privileged services.
References: app/index.js• L120-187 app/index.js• L198-238 app/…/browserWindowManager.js• L85-112
Security boundary
The Teams window runs without Node integration, but it also uses disabled context isolation and sandboxing because the app needs to work with the Teams page. IPC validation is the compensating boundary: the main process checks every renderer-initiated channel against an allowlist and removes prototype-pollution fields from payload objects before a handler runs.
The preload exposes a small application API instead of exposing the Electron module. It validates several high-risk values before sending them, while the main process remains the final authority for channel access and native work. See IPC and API security for the channel contract and token-bearing API paths.
References: app/…/browserWindowManager.js• L100-110 app/…/ipcSecurity.js• L3-18 app/…/ipcSecurity.js• L87-119 app/…/ipcValidator.js• L172-217 app/…/preload.js• L91-215
Browser hooks
Teams page bridge
Browser integration adapts the Teams web client to desktop behavior. The preload restores features that Teams expects from its host, exposes native actions such as screen sharing and notifications, and forwards state changes such as user status, navigation, and unread counts to the main process.
The hooks are scoped to the Teams origin when they expose local data or change browser behavior. For example, file paths are restored only for approved Teams hosts so authentication pages cannot use the same hook to inspect local files. Other changes patch browser behavior without changing the main process boundary.
The main process can also run a small set of Teams-side helpers to read state or request a Teams-owned operation. Microsoft Graph uses this path to ask the signed-in Teams session for its own Graph token, then keeps the token in the main process rather than returning it to the renderer. See Browser integration and tools for page hooks and injected tools.
References: app/…/README.md• L3-20 app/…/preload.js• L3-77 app/…/preload.js• L79-215 app/…/index.js• L18-87
Microsoft Graph access
The optional Graph service gives desktop features access to user, calendar, mail, people, and chat data through the permissions already granted to the signed-in Teams web client. It does not create a separate application identity or ask for wider permissions.
When enabled, the service obtains a short-lived token from the Teams session and uses it for the supported Graph requests. IPC handlers return operation results rather than the token. When disabled, the handlers remain unavailable as a useful feature and report that Graph access is not enabled.
References: app/…/README.md• L1-37 app/…/ipcHandlers.js• L10-22 app/…/ipcHandlers.js• L68-99
Desktop controls
Window and navigation controls
The desktop shell turns Teams events into native window behavior. Calls can keep the display awake, incoming calls can show a native toast or run a configured user command, and a second app launch can bring the existing window to a Teams deep link.
Deep links prefer the loaded Teams single-page app when the target is a trusted Teams origin. If the app does not consume the route, the shell falls back to a full navigation. The router does not log route values because they can contain email addresses or meeting identifiers.
The main window also owns the native screen-share picker and preview. Each session that hosts Teams content gets a screen-capture handler, and the selected source is passed through without a second enumeration so desktop portals keep the same source identity.
References: app/…/browserWindowManager.js• L149-259 app/…/deepLinkRouter.js• L1-17 app/…/deepLinkRouter.js• L76-147 app/…/index.js• L73-125
Menus tray and shortcuts
Menus provide the visible desktop control surface. The application menu and system tray can open, hide, refresh, join a meeting, switch profiles, change settings, control notifications, and quit with optional storage clearing. The tray also reflects Teams activity through its icon, flash state, and unread count.
Configured global shortcuts work even when the window is not focused. The main process registers them with the operating system and forwards the matching key event to the Teams window. A shortcut that the desktop already owns is skipped rather than replacing another application’s binding.
See Desktop integration and menus for the menu, tray, profile, and shortcut controls.
References: app/…/README.md• L1-14 app/…/appMenu.js• L4-100 app/…/tray.js• L5-20 app/…/tray.js• L46-70 app/…/index.js• L72-132
Notifications and downloads
The notification service converts Teams activity into native notifications and sound while applying user status and notification settings. The download service adds visible progress and completion or failure feedback to an Electron download that would otherwise happen with little desktop feedback.
The app uses several desktop feedback paths because Linux desktop environments do not expose one common progress surface. It can use a taskbar or dock indicator, KDE job progress, window-title text, and native notifications. Missing desktop services reduce the feedback surface but do not change the download or Teams session itself.
References: app/…/README.md• L1-39 app/…/README.md• L1-47 app/index.js• L156-187
Operating-system services
Screen sharing and power control
Screen sharing crosses from the Teams page to the desktop capture service. The app presents a native-aware source picker, returns the chosen display or window to Teams, and can show a small preview window with a stop control. During a call it can inhibit display sleep through Electron or coordinate a browser wake lock, according to configuration.
On Wayland, the desktop portal gives a source identity to the picker. That identity must remain tied to the original enumeration. If the app asks the portal for a new list before starting the stream, the selected source can no longer match and sharing fails.
References: app/…/README.md• L1-31 app/…/README.md• L39-70 app/…/browserWindowManager.js• L149-192 app/…/index.js• L73-125
Certificate and smartcard services
Enterprise sign-in can depend on two certificate paths. A configured custom CA fingerprint can allow a corporate certificate authority while all other certificate errors remain rejected. Smartcard-backed client certificates can request a PIN through a hardened native prompt on Linux.
The certificate path is allowlist-based and applies to the sessions used by the main window and profiles. The smartcard path keeps the PIN in the prompt result, rejects cancellation, and limits submitted attempts per token for the app session. These services extend authentication without exposing certificate or PIN material to Teams page code.
References: app/…/index.js• L13-35 app/…/index.js• L47-65 app/…/index.js• L71-145 app/…/README.md• L1-13 app/…/index.js• L28-90
Flatpak background service
The Flatpak build can ask the desktop background portal for permission to keep calls ringing and notifications active while the window is hidden. If the portal grants permission, the app publishes a short status for the desktop background-app view. This integration is limited to Flatpak and degrades to logs when the portal is absent or rejects the request.
The request preserves the user’s existing autostart state. The app does not turn autostart on or off as a side effect of requesting background permission.
References: app/…/README.md• L1-42 app/…/index.js• L1-24 app/…/index.js• L46-91 app/…/index.js• L124-184
D-Bus control services
D-Bus control services provide desktop-facing control paths that operate outside the Teams page. They let supported desktop clients request app actions through the operating system bus while the main process remains responsible for authorization and state changes. See D-Bus control services for the service boundaries and request flow.
These services complement the menus, tray, and renderer bridge. A desktop client can use a bus request when the Teams window is hidden or when it cannot access the Electron UI, while the app keeps the resulting action within its normal main-process control path.
References: app/index.js• L120-187 app/…/appMenu.js• L4-100
Service flow
The following flow shows how a Teams action reaches a desktop service and returns state to the web client.
flowchart LR
A[Teams web client] --> B[Preload browser bridge]
B --> C{Allowed IPC request}
C --> D[Electron main process]
D --> E[Desktop service]
E --> F[Operating system or portal]
F --> D
D --> B
B --> A
The same model applies to screen capture, notifications, desktop controls, Graph requests, authentication prompts, and D-Bus requests. The service decides whether a request is enabled and whether the operating system can complete it. The Teams page receives only the result or a bounded state update.
Change checklist
When these files or sections are changed, remember to consider these:
- Keep every renderer-facing IPC channel aligned between app/…/preload.js, its main-process handler, and app/…/ipcValidator.js.
- Preserve the distinction between renderer-to-main requests and main-to-renderer notifications when changing the IPC allowlist.
- When adding a profile or session partition, bind session-level certificate, screen-sharing, download, and window-open behavior to that session as needed.
- When changing a native desktop action, keep its non-Linux, missing-portal, and denied-permission behavior non-fatal.
- When changing a token or certificate flow, keep secrets out of renderer responses and logs.
- When changing deep-link routing, retain origin checks and the full-navigation fallback.
- When changing a D-Bus action, keep its bus-facing contract mapped to the same main-process state change used by other desktop controls.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A renderer sends a channel that is not in the IPC allowlist | The request is rejected before its native handler runs. | Central channel validation and payload sanitization. |
| A Wayland source is re-enumerated before stream start | The selected source ID no longer matches the portal session and screen sharing fails. | Pass the picker’s original source directly to the capture callback. |
| A custom certificate authority fingerprint is missing or wrong | Enterprise TLS connections remain rejected. | Explicit fingerprint allowlist with Chromium verification for other errors. |
| A user cancels a smartcard PIN prompt | Client-certificate authentication stops instead of repeatedly prompting. | Reject the password request and cap submitted PIN attempts. |
| A desktop portal or D-Bus service is unavailable | The related background, control, or progress surface is absent. | Gate platform integrations and degrade to logs or other desktop feedback. |
| A global shortcut is already owned by another application | That shortcut does not reach Teams. | Check registration success and leave the existing binding unchanged. |
Key files
| File | Why to read it |
|---|---|
| app/index.js | Shows startup wiring for security, platform services, protocol handling, sessions, and app lifecycle. |
| app/…/browserWindowManager.js | Defines the main window security posture and call-related desktop behavior. |
| app/…/preload.js | Shows the browser-to-main bridge used by the Teams page. |
| app/…/ipcSecurity.js and app/…/ipcValidator.js | Define the IPC security boundary and its allowed surface. |
| app/…/index.js and app/…/deepLinkRouter.js | Explain screen-share session binding, preview behavior, and deep-link navigation. |
| app/…/README.md | Gives the product-level screen-sharing and desktop-portal model. |
| app/…/index.js, app/…/appMenu.js, and app/…/tray.js | Show how app menus and the system tray expose desktop controls. |
| app/…/README.md and app/…/ipcHandlers.js | Explain the optional Graph API boundary and its renderer-facing operations. |
| app/…/index.js and app/…/index.js | Define enterprise CA trust and smartcard PIN boundaries. |
| app/…/index.js | Shows the Flatpak-only background permission integration. |
app/dbus/ | Shows the desktop bus control services and their relation to the main process. |