Disclaimer: This project was built for personal use and tied to a specific setup. It probably won't work as expected for you.
ptt-mic is a push-to-talk daemon for Linux, written in Rust. It reads raw input events from an evdev device and runs commands on button press and release. Supports runtime mode switching and IPC via a Unix socket.
- Rust toolchain (
cargo) - Your user needs to be in the
inputgroup to read evdev devices without root:
sudo usermod -aG input $USERLog out and back in after running this.
obs-cmdif you want OBS mode.notify-sendfor desktop notifications (optional).
Download the latest binary from the release page or build from source.
cargo build --release1. Find your device path
Figure out which /dev/input/eventX is your mouse or keyboard.
2. Create a config file
Default location: ~/.config/ptt-mic/config.toml
[general]
device = "/dev/input/event6" # run `evtest` to find your desired device
notify = true
default_mode = "desktop"
[mode.obs]
[[mode.obs.binds]]
button = "BTN_SIDE" # run `evtest` to find your button event code
press = ["obs-cmd", "audio", "unmute", "Mic/Aux"]
release = ["obs-cmd", "audio", "mute", "Mic/Aux"]
[mode.desktop]
device = "/dev/input/event11"
[[mode.desktop.binds]]
button = "KEY_V"
press = ["pactl", "set-source-mute", "@DEFAULT_SOURCE@", "0"]
release = ["pactl", "set-source-mute", "@DEFAULT_SOURCE@", "1"]3. Install the systemd user service
./target/release/ptt-mic installThis generates the service file, reloads the systemd daemon, and enables and starts ptt-mic.
Once the daemon is running, use the CLI to talk to it.
# Switch mode
ptt-mic mode <name>
ptt-mic mode desktop
# Enable or disable listening
ptt-mic enable
ptt-mic disable
ptt-mic toggle
# Check status
ptt-mic statusptt-mic uninstallStops the service and removes the systemd file.
There are no restrictions on what actions you can trigger. Press and release are just shell commands, so you can wire up anything that has a CLI:
press = ["pactl", "set-source-mute", "@DEFAULT_SOURCE@", "0"]
release = ["pactl", "set-source-mute", "@DEFAULT_SOURCE@", "1"]Any tool that can be called from a terminal works here.
Only tested on CachyOS with the Niri compositor. Never tested on other distros or window managers.
For audio I use PipeWire, but since actions are just shell commands you can use whatever backend you want. pactl should cover most setups.
There are plenty of things in my mind to improve but this (project) isn't my main focus right now. If you feel like something a PTT daemon should have is missing, feel free to contribute. I'll check it when I can.