According to headset-button-enabler description, when it is installed and a headset button is pressed, "ButtonPressed" signal is emitted by HAL... it should be possible to catch that signal in Python somehow... .