Introducing a new way to review your PRs.

Read the announcement

ismaelmartinez / teams-for-linux

Unofficial Microsoft Teams for Linux client

View on GitHub

23 documents · Updated Nov 23, 2026

docs / dbus-control-services

DBus control services

The D-Bus control service is an optional Linux interface for desktop automation. It publishes selected Teams state on the user's session bus and accepts a small set of named call and meeting commands. It stays separate from MQTT and from the Teams web page: the main process observes Teams events, checks the active profile, and exposes only the fixed actions defined by this service.

Service boundary

Opt-in control surface

The control surface is disabled by default and starts only when dbusControl.enabled is true on Linux. The setting takes effect after an application restart. On other platforms, the application does not load or connect to D-Bus.

This opt-in also enables the local Teams monitors needed to produce presence, call, camera, microphone, screen-share, and meeting-start state. It does not enable MQTT or change the existing MQTT publishing path. See Platform services for the wider main-process service boundary and Security and web APIs for the related renderer-to-main controls.

References: app/…/options.js• L31-42 app/index.js• L699-735 app/…/mqttStatusMonitor.js• L43-54

Session-bus registration

The service registers on the user's session bus with a well-known name. Flatpak uses FLATPAK_ID as the name so the packaged app matches its sandbox identity; other Linux runs use com.github.IsmaelMartinez.teams_for_linux. The object path and interface remain stable for clients.

ItemValue
BusUser session bus
Service nameFLATPAK_ID, or com.github.IsmaelMartinez.teams_for_linux
Object path/com/github/IsmaelMartinez/teams_for_linux
Interfacecom.github.IsmaelMartinez.teams_for_linux.Control

The service does not queue for a name already owned by another process. A bus error, name conflict, export error, or startup timeout disables this control surface without stopping the desktop app. When the connection ends, the service drops its name and state listeners.

References: app/…/controlService.js• L1-4 app/…/controlService.js• L48-67 app/…/controlService.js• L70-131 app/…/controlService.js• L194-224

Isolation boundary

The D-Bus adapter is a narrow transport layer over TeamsControlService. It has no arbitrary shortcut input, calendar API, Graph API, or writable state properties. Each exported command maps to one known application action, and each command returns true only when that action was accepted for dispatch.

D-Bus clients on the same user session are not individually authorized by this interface. The security boundary is therefore the explicit user opt-in and the fixed command set, not the identity of a D-Bus caller. Caller details are also independently opt-in because they can contain personal information.

References: app/…/controlService.js• L6-36 app/…/controlService.js• L105-120 app/…/controlService.js• L134-152 app/…/teamsStateService.js• L27-33

Teams state model

Observed state snapshot

The state service turns events observed from Teams into one transport-neutral snapshot. GetState returns that snapshot as JSON, while StateChanged and typed signals let automation react without polling.

The snapshot has these fields:

Field groupMeaning
PresencepresenceStatus and its numeric presenceStatusCode
CallinCall, incomingCall, and optional incomingCallCaller
MediacameraEnabled, microphoneState, and microphoneControlState
Desktop activityscreenSharing and the short-lived meetingStarted pulse

Initial values use unknown for unobserved presence or microphone state, false for boolean state, and null for the caller. These values describe what the desktop has observed. They are not a second source of server-confirmed Teams state.

References: app/…/teamsStateService.js• L12-18 app/…/teamsStateService.js• L29-33 app/…/teamsStateService.js• L43-58 app/…/controlService.js• L145-152

Profile scope

Presence and media state follow the selected Teams profile. Events from a background profile update that profile's stored observation but do not replace the state shown through D-Bus while another profile is active. A profile switch causes a fresh state publication so automation does not keep the old workspace's values.

Incoming-call state is different. It describes the latest ringing renderer because an incoming call may need an action before the user changes profiles. The caller record is sanitized and appears only when caller reporting is enabled.

References: app/…/teamsStateService.js• L43-85 app/…/teamsStateService.js• L100-139 app/index.js• L792-793

State signals

The interface sends a full JSON snapshot through StateChanged. It also sends typed signals when an individual value changes: presence, call state, caller, camera, microphone observation, microphone control state, screen sharing, and meeting-start state.

Clients should call GetState after they connect, then use signals for changes. The service compares a safe copy of the last snapshot before sending typed signals, so a signal normally represents a change rather than a repeated observation.

References: app/…/controlService.js• L20-30 app/…/controlService.js• L154-192 app/…/teamsStateService.js• L61-70

Command surface

Call commands

The call commands target the latest known incoming-call renderer. AcceptAudio, AcceptVideo, and DeclineCall request the matching Teams call action. They fail closed when the target is unavailable or the application action fails.

Meeting commands

The meeting commands target the selected profile's Teams renderer through fixed shortcuts. ToggleMute, ToggleVideo, ToggleHandRaise, and LeaveCall expose named actions rather than accepting a caller-supplied accelerator.

Mute(force) and Unmute(force) add a state guard around the mute toggle. They return false when the requested state is already known, when the current state is unknown and force is not true, or when the argument is not a Boolean. A successful return means that the desktop dispatched the action. It does not confirm that Teams has completed the action.

References: app/…/teamsControlService.js• L39-81 app/…/teamsControlService.js• L83-103 app/…/controlService.js• L105-118

State query

GetState provides an immediate JSON snapshot for clients that start after the service or miss an event. If the state cannot be read or encoded, it returns {"error":"State unavailable"} instead of exposing a partial result.

References: app/…/controlService.js• L145-152 app/…/controlService.js• L169-190

Automation flow

The D-Bus path joins Teams page observations, active-profile selection, main-process control, and desktop automation. The diagram shows the normal direction of state and command traffic.

flowchart LR
    T[Teams web page] -->|approved IPC and app events| S[Teams state service]
    S --> C[Teams control service]
    C --> D[D-Bus control service]
    D -->|state snapshot and change signals| A[Desktop automation]
    A -->|named command| D
    D --> C
    C -->|fixed call action or shortcut| T
    P[Profile switch] --> C

The same observed events can feed MQTT when MQTT is enabled. D-Bus adds a separate consumer of the state service; it does not replace or alter MQTT publications. See Browser integration and tools for the Teams-page side of these events and Desktop integration and menus for other native controls.

References: app/index.js• L699-717 app/…/teamsStateService.js• L93-139 app/…/teamsControlService.js• L11-19 app/…/controlService.js• L154-187 app/…/mediaStatusService.js• L43-67

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep the D-Bus descriptor, exported handlers, and control-service method names aligned. A mismatch can make a client see a method that cannot perform its action.
  • Keep the ten state fields aligned across the state snapshot, GetState, full-state signals, and typed change signals.
  • Keep profile switching tied to a fresh state publication so automation does not use values from the previous workspace.
  • Keep caller reporting behind its privacy setting across every transport that consumes the shared state.
  • Keep the Linux and explicit opt-in checks on both service startup and the browser monitors that produce its state.
  • Keep the bus name and Flatpak identity aligned with package confinement. Do not add broad bus permissions as a fallback for a registration failure.

Important failure modes

TriggerConsequenceGuard
D-Bus is not explicitly enabled on LinuxNo service or local state monitors startSet dbusControl.enabled to true and restart the app
Another process owns the well-known nameThe interface is not exportedThe service does not queue and continues without D-Bus control
The active profile renderer is unavailableProfile-scoped commands return false and state remains unknown or defaultedWait for the renderer, then query GetState again
A mute request has an unknown state without force=trueThe command is rejected instead of risking the wrong toggleRefresh state or use the explicit force Boolean when automation accepts that risk
A D-Bus client sends arbitrary shortcut textNo arbitrary key action is availableUse one of the named command methods
Caller reporting is enabled without considering personal dataCaller details can reach session-bus clientsKeep caller reporting disabled unless the user accepts that exposure
The session bus disconnects or startup times outThe service stops and its exported commands return falseTreat D-Bus as optional and reconnect through an app restart or service lifecycle

Key files

FileWhy to read it
app/…/controlService.jsDefines service registration, the public D-Bus contract, signal publication, and shutdown behavior.
app/…/teamsStateService.jsDefines the shared Teams state model, profile scope, event inputs, and default values.
app/…/teamsControlService.jsDefines the named call and meeting commands and their fail-closed behavior.
app/index.jsShows the Linux opt-in lifecycle and the connection between profile state, Teams control, and D-Bus.
app/…/options.jsDefines the user-facing opt-in setting and its restart requirement.
docs-site/…/dbus-control.mdProvides the client-facing bus values, method signatures, signal names, and command examples.