Skip to content

Instantly share code, notes, and snippets.

@altbrace
altbrace / bt-onconnect.py
Last active April 5, 2024 06:38
Automatic sound profile change on Bluetooth device connect
#!/usr/bin/env python3
# Ref https://gist.github.com/altbrace/52ae1783b31257021520673fadb95b6e
from pydbus import SystemBus
from gi.repository import GLib # don't mind the import error if you get one, it should work
import subprocess
import time
import re
ADDRESS = '74_5C_4B_0C_C4_41' # your Bluetooth device's MAC separated by underscores