Pulseaudio push-to-talk
Url
On HN
Category
Uses the pacmd
command.
Wrapped by
Keycodes might not be the same as reported by xev
. Matching ones be obtained with this (run as root):
from libinput import ContextType, EventType, KeyState, LibInput
seat = 'seat0'
li = LibInput(context_type=ContextType.UDEV)
li.assign_seat(seat)
for event in li.events:
if event.type == EventType.KEYBOARD_KEY:
keycode = event.key
ks = event.key_state
key_press = ks is KeyState.PRESSED
print("Code: {} | State: {}".format(keycode, "↓" if key_press else "↑"))