Author: Devon Yanitski and Gemini CLI 0.1.13
This toolbox integrates Discord Rich Presence with MATLAB, allowing you to display the .m file you are currently editing in your Discord status. It automatically updates as you switch between files, similar to the VS Code "vscord" extension.
- Automatic Detection: Shows the currently active file in the MATLAB editor.
- Real-Time Updates: Status updates within seconds of switching files.
- Silent & Efficient: Runs in the background with minimal performance impact.
- Easy Setup: A one-time setup command is all that's needed.
- Cross-Platform: Works on Windows, macOS, and Linux.
-
Install the Toolbox:
- Download the
.mltbxfile from the latest release. - Double-click the
.mltbxfile or drag it into the MATLAB command window. - Follow the on-screen instructions to complete the installation.
- Download the
-
Run the Setup Command:
-
After installation, run the following command in the MATLAB console:
discordrpc.setup()
-
-
Follow On-Screen Prompts:
- The setup script will check for Python and the required
pypresencelibrary. - If
pypresenceis not found, it will prompt you to install it automatically. - It will also configure MATLAB to start the integration automatically on launch and stop it when MATLAB closes.
- The setup script will check for Python and the required
-
Restart MATLAB:
- For the changes to take effect, restart MATLAB.
-
Ensure Discord is Running:
- The integration requires the Discord desktop application to be running in the background.
Once installed and set up, the integration runs automatically. There are no further steps required. Your Discord status will show the file you are editing whenever MATLAB is open.
To manually control the integration, you can use the following commands:
- Start the integration:
discordrpc.start() - Stop the integration:
discordrpc.stop()
The toolbox uses a background MATLAB timer to periodically check the active file in the editor. When a file change is detected, it calls a lightweight Python script (update_presence.py) that communicates with the local Discord client via its Rich Presence API.
This approach is necessary because MATLAB cannot directly interface with Discord's IPC socket.
-
"Python not found": Ensure Python is installed and its location is included in your system's
PATHenvironment variable.On Windows, install Python from python.org rather than the Microsoft Store. The Store version places a stub named
python.exeon yourPATHthat opens the Store instead of running Python; the toolbox skips that stub, but it can leave you with no usable interpreter. -
"pypresence not installed": If the automatic installation fails, open a terminal or command prompt and run:
pip install pypresence. -
"The background helper did not start": Python launched but the helper script exited immediately, almost always because
pypresenceis missing from the interpreter the toolbox found. The warning names that interpreter; installpypresenceinto it specifically, then rundiscordrpc.setup()again. -
Status not updating: Make sure Discord is running and that you have enabled "Display current activity as a status message" in Discord's settings (User Settings > Activity Privacy).
You do not need to start Discord before MATLAB. The helper retries the connection every 15 seconds, so your status appears shortly after Discord comes up.
-
Status stuck after MATLAB closed: The helper watches the MATLAB process that started it and exits within a few seconds of MATLAB going away, including after a crash or a force quit. If a status somehow persists,
discordrpc.stop()in a new MATLAB session clears it.
