A lightweight tray app that automatically updates your Mattermost custom status with your currently playing Spotify song.
- Shows your current Spotify song as your Mattermost status
- Clears the status automatically when paused or stopped
- Tray icon toggle for quick enable/disable
- Works cross-platform (Linux, tested on GNOME/Ubuntu)
git clone https://github.com/<yourname>/mm_spotify_status.git
cd mm_spotify_statusbash setup.shThe setup automatically:
- Installs all system dependencies (GTK, GObject, Cairo, etc.)
- Creates and configures a Python virtual environment
- Installs only lightweight Python packages (
requests,python-dotenv) - Offers optional autostart via
systemd
🟡 Important: After the first run, open the .env file and fill in your Mattermost and Spotify credentials.
Example:
nano .envDuring setup, you’ll see a reminder to edit this file before starting the app.
- Log in to your Mattermost instance.
- Go to Account Settings → Security → Personal Access Tokens.
- (If tokens are disabled, ask your admin to enable them.)
- Create a new token and note it down (you can skip this if you use username/password login, as the script does).
- Fill your Mattermost URL, username and password (or token if you modify the script to use it) in
.env.
Example:
MM_URL=https://chat.company.com
MM_USER=johndoe
MM_PASS=mysecurepasswordTo get your Spotify tokens, follow these steps:
- Go to the Spotify Developer Dashboard.
- Log in and click Create an App.
- Give it a name (e.g., “Mattermost Status Sync”).
- In Redirect URI, enter
http://localhost:8888/callback(you can change it later). - Save your Client ID and Client Secret — put them into
.env.
Then, to get a Refresh Token:
- Run a small helper tool like Spotify Token Generator
- Or follow a manual tutorial: https://developer.spotify.com/documentation/web-api/tutorials/refreshing-tokens
You’ll receive a refresh_token. Add it to your .env.
Example:
SPOTIFY_CLIENT_ID=abcd1234
SPOTIFY_CLIENT_SECRET=efgh5678
SPOTIFY_REFRESH_TOKEN=long_refresh_token_hereDuring setup, you’ll be asked whether you want to enable automatic startup using systemd (user mode).
If enabled, the installer creates this file automatically:
~/.config/systemd/user/mm-spotify-tray.service
It uses your .env for configuration (no secrets inside the file) and runs the app automatically after login.
You can manage it manually with:
systemctl --user start mm-spotify-tray.service # start manually
systemctl --user stop mm-spotify-tray.service # stop
systemctl --user enable mm-spotify-tray.service # enable autostart
systemctl --user disable mm-spotify-tray.service # disable autostartTo view logs:
journalctl --user -u mm-spotify-tray -fTo remove the service entirely:
systemctl --user disable --now mm-spotify-tray.service
rm ~/.config/systemd/user/mm-spotify-tray.serviceIf you didn’t enable autostart, you can still run manually:
./venv/bin/python mm_spotify_status.py &A tray icon will appear. Toggle “Spotify Status aktiv” to start or stop syncing.
-
GTK / AppIndicator missing: The setup installs these automatically, but if you ever need to reinstall:
sudo apt install python3-gi python3-gi-cairo gir1.2-gtk-3.0 gir1.2-appindicator3-0.1
-
Spotify not showing anything: Make sure Spotify is playing on the same account linked in
.env. -
Mattermost 401 errors: Check your credentials or regenerate your access token.
Installed automatically by setup:
- GTK 3 runtime (gir1.2-gtk-3.0)
- AppIndicator support (gir1.2-appindicator3-0.1)
- GObject and Cairo libs (python3-gi, python3-gi-cairo)
- Virtual environment tools (python3-venv, pip)
Python-only (in venv):
- requests
- python-dotenv
MIT © 2025 Knabbiii