Because forgetting to clear your "In a Meeting" status three hours after the call ended is a universal human experience.
This lightweight, blazingly fast background daemon monitors your webcam usage (/dev/video*) and automatically updates your Mattermost status and availability. When the camera turns on, it appends a customizable message (like " [In a meeting]") to your current status and sets your availability to "Do Not Disturb" (DND) or another chosen one. When the camera turns off, your previous status and availability (Online, Away, etc.) are restored exactly as they were.
- Fully Configurable: Change your tokens, sync interval, and custom away messages on the fly using native
snap setcommands. - Smart Offline Detection: If you close your laptop or go "Offline" in Mattermost, the daemon smartly ignores your camera and will not force your status back to "Online" while you sleep.
- State Preservation: Backs up your exact state (Emoji, Text, and Availability) safely in the Snap
$SNAP_DATAdirectory and restores it flawlessly. - Native & Zero-Overhead: Written in Rust using a fully asynchronous
tokioruntime. It replaces bulkyfuser/jq/curlsub-shells by reading the Linux kernel's/procfile descriptors natively, using practically zero CPU or memory.
To build this project from source, you will need:
- Rust & Cargo
- Snapcraft (
sudo snap install snapcraft --classic)
-
Build the Snap Package: Navigate to the root of the project directory and run the following commands to compile the Rust binary and package it:
snapcraft clean snapcraft pack
-
Install the Snap: Install the generated
.snapfile locally. The--classicflag is required so the daemon has the system privileges necessary to monitor host video devices via the/procfilesystem.sudo snap install mm-status-sync_*.snap --dangerous --classic
To use this daemon, you need three pieces of information from your Mattermost server.
This is the base URL you use to access Mattermost in your browser.
- Format:
https://mattermost.example.com - Note: Do not include a trailing slash or specific channel names.
A Personal Access Token allows the daemon to act on your behalf safely.
- Log in to your Mattermost web interface.
- Click on your Profile Picture -> Profile.
- Select Security from the sidebar.
- Click on Personal Access Tokens.
- Click Create New Token (e.g., name it
mm-status-sync). - Copy the Access Token immediately. You will not be able to see it again.
Note: If you do not see this menu, your System Administrator may need to enable "Personal Access Tokens" in the System Console.
The User ID is a unique 26-character alphanumeric string. Because it is often hidden in the UI, use one of these three methods:
If your organization uses Single Sign-On (SAML):
- Go to Profile > Security.
- View your Access History.
- Your User ID is often explicitly listed in the session details or metadata fields on this page.
- e.g.
Saml {id}underAction
- Press
F12to open Browser Dev Tools. - Go to the Network tab.
- Refresh the page.
- Search for a request named
me. You can filter by/api/v4/users/me - The
idfield in the Preview/Response JSON is your User ID.- e.g. Get a user
{ "id": "string", "create_at": -9007199254740991, "update_at": -9007199254740991, "delete_at": -9007199254740991, "username": "string", "first_name": "string", "last_name": "string", "nickname": "string", "email": "string", "email_verified": true, "auth_service": "string", "roles": "string", "locale": "string", "notify_props": { "email": "string", "push": "string", "desktop": "string", "desktop_sound": "string", "mention_keys": "string", "channel": "string", "first_name": "string", "auto_responder_message": "string", "push_threads": "string", "comments": "string", "desktop_threads": "string", "email_threads": "string" }, "props": {}, "last_password_update": -9007199254740991, "last_picture_update": -9007199254740991, "failed_attempts": 0, "mfa_active": true, "timezone": { "useAutomaticTimezone": "string", "manualTimezone": "string", "automaticTimezone": "string" }, "terms_of_service_id": "string", "terms_of_service_create_at": -9007199254740991 } }
- e.g. Get a user
The daemon runs automatically in the background as a system service. However, it will remain in a sleep loop until you provide your Mattermost credentials.
You configure the daemon using Snap's native configuration hooks.
You must set all three of these for the daemon to connect to your workspace:
sudo snap set mm-status-sync url="https://your-mattermost-url.com"
sudo snap set mm-status-sync token="your-personal-access-token"
sudo snap set mm-status-sync user-id="your-user-id"(Note: You can generate a Personal Access Token in Mattermost under Account Settings > Security > Personal Access Tokens).
You can fine-tune the daemon's behavior. If you do not set these, it will fall back to the default values.
# Check the camera every X seconds (Default: 300, Minimum: 10)
sudo snap set mm-status-sync sleep-seconds="60"
# Change the appended status message (Default: " [In a meeting]")
sudo snap set mm-status-sync meeting-message="🎥 On a call"
# Change the status availability (Default: "dnd")
# Available options: online|away|offline|dnd
# https://developers.mattermost.com/api-documentation/#/operations/UpdateUserStatus#request-body
sudo snap set mm-status-sync meeting-status="online"
# Prevent the daemon from updating your status if you are currently marked as "Offline" (Default: true)
sudo snap set mm-status-sync ignore-if-offline="true"To see your currently active settings at any time, run:
sudo snap get mm-status-syncBecause this runs headlessly, you will need to rely on Snap's built-in tools to monitor its health.
If your status isn't updating, the best place to start is the daemon's output logs. You can follow the live log stream by running:
sudo snap logs -f mm-status-syncCommon Log Messages:
INFO: Starting Mattermost Status Sync Daemon...: The service has successfully started or restarted.WARN: Config missing or invalid: The daemon is missing the URL, Token, or User ID. It will retry on the next tick.INFO: BACKUP: Saved original status: The camera turned on, and your previous status was securely saved to disk.INFO: RESTORE: Status restored (Avail: online) and backup deleted.: The camera turned off, and your original status and availability were returned to normal.INFO: RESTORE SKIPPED: User is currently offline.: The camera turned off, but because you went offline during the meeting, the daemon safely deleted the backup without forcing your status to "Online".ERROR: API ERROR: Failed to set meeting status: The daemon could not reach your Mattermost instance. Check your URL, Token, and network connection.