Control OBS Studio from the command line and, optionally, display an interactive notification after an action has been executed.
- Control OBS Studio over WebSocket
- Displays a notification after an action has been executed with, if applicable, options to open the saved file or the folder containing it
- Allows for control of OBS Studio with keyboard shortcuts on Wayland
- Linux operating system
- OBS Studio 28 or higher
- Python 3.13 or higher (could work on lower versions, but hasn't been tested)
- For notification support:
notify-sendfor thenotify-sendnotification type- KDE Plasma 6 for the
osdnotification type
- Clone and enter this repository
- Create a virtual environment:
python -m venv .venv - Activate virtual environment:
source .venv/bin/activate - Install required dependencies:
pip install -r requirements.txt - Execute
obs-controlto generate the default configuration fileconfig.json - Enable the WebSocket server in OBS Studio (Tools → WebSocket Server Settings) and configure authentication settings
- Fill out
config.jsonwith the appropriate WebSocket server settings - Execute
obs-controlagain to test the connection
obs-control [-h] [-n NOTIFICATION_TYPE] SCOPE ACTION
SCOPE |
ACTION |
|---|---|
connection |
test |
recording |
start, stop, toggle, pause, resume, toggle-pause |
replay-buffer |
start, stop, toggle, save |
notify-send(notify-sendrequired, default)osd(KDE Plasma 6 required)stdout
- The interactivity of the notifications depends on the used desktop environment. Testing was done only on KDE Plasma 6, but theoretically, most of the functionality should work in every environment.
- The
osdnotification type interacts directly with the D-Bus message system and uses a method exposed by KDE Plasma itself, so it's currently impossible to use it in other desktop environments. This type of notification is also not interactive and very limited on how much text can it display.
This will depend on your desktop environment:
- On KDE Plasma 6:
- Open System Settings → Keyboard → Shortcuts
- Add the script by pressing Add New → Command or Script...
- Set Command: to point at the
obs-controlscript and set your desired arguments - Set Name: to be what you see fit
- Set Command: to point at the
- Assign a keyboard shortcut
As an avid Replay Buffer user, I needed a quick and simple way to save the replay with the ability to preview the file or open the directory where it was saved. Because OBS lacks an option to quickly open the most recently saved replay, and, on Wayland, currently doesn't support global hotkeys, this script was created.
