Skip to content

Instantly share code, notes, and snippets.

@brubrant
Forked from kode54/obs-recording-toggle.py
Created June 24, 2024 21:04
Show Gist options
  • Save brubrant/33fc239f90dc1ba796a1919f2396f353 to your computer and use it in GitHub Desktop.
Save brubrant/33fc239f90dc1ba796a1919f2396f353 to your computer and use it in GitHub Desktop.
OBS Recording Toggle, based on obs-wayland-shortcuts, but using obs-cli and not obs-cli-leafac.
#!/usr/bin/env python3
# Original Author: Andrew Shark
# Homepage: https://gitlab.com/AndrewShark/obs-wayland-shortcuts
# License: GPLv3
# Modified By: Christopher Snowhill
# This script is made for convenience. It is invoked by a logid gesture for MX Master mouse.
# It also works when invoked by a keyboard shortcut from your preferred Wayland compositor/desktop environment.
import subprocess
obs_cli = "/usr/bin/obs-cli"
obs_password = "<your password here>"
p2_result = subprocess.run([obs_cli, "--password", obs_password, "recording", "toggle"], capture_output=True).stdout
print(p2_result)
@brubrant
Copy link
Author

This didn't work for me on Manjaro. The obs_cli is outdated.

What Worked:

Enabled websocket on OBS
Instaled this lib using pipx: https://github.com/pschmitt/obs-cli
Added this command on my wayland custom shortcuts: obs-cli -p -P record toggle
(change the password and the port on the above command)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment