Discord Push-to-Talk for Linux is now a Go tool that enables global PTT for Discord on Linux, including Wayland setups where Discord push-to-talk may not work reliably.
Discord on Linux can have trouble with global Push-to-Talk, especially on Wayland. This project works around that by listening for an input event and sending the configured Discord shortcut.
Use this project if you want global Push-to-Talk for Discord on Linux using a mouse side button or another input device.
- Watches a Linux input device such as a mouse side button.
- Detects and saves your device path and button code.
- Sends your configured Discord Push-to-Talk shortcut when that button is pressed and released.
- Can run directly from the repo, from a built binary, or through the included Home Manager module.
- Run Discord in X11 mode so you can set the Discord Push-to-Talk keybind.
- Install the required packages for your Linux distribution.
- Choose either the normal install or the Nix install.
- Detect your input device and button with
setup. - Start the daemon so push-to-talk works while Discord is running.
Run Discord with:
discord --enable-features=UseOzonePlatform --ozone-platform=x11Use this Discord session to set your keybind.
In Discord:
User Settings -> Voice & Video- Set
Input Mode = Push to Talk - Set PTT keybind to
Shift + =
If you use another combo, it must match your tool config later.
Core (required for PTT):
sudo apt update
sudo apt install golang-go xdotoolsudo dnf install golang xdotoolsudo pacman -S go xdotoolOptional (for the Home Manager Rofi menu and notifications):
- Ubuntu / Debian:
sudo apt install rofi libnotify-bin - Fedora:
sudo dnf install rofi libnotify - Arch:
sudo pacman -S rofi libnotify
Build the binary from this repo:
go build -o discord-ptt-go .Install it to a stable user path:
mkdir -p ~/.local/bin
cp ./discord-ptt-go ~/.local/bin/discord-ptt-go
chmod +x ~/.local/bin/discord-ptt-goVerify the install:
~/.local/bin/discord-ptt-go helpBuild with Nix:
nix-build default.nixVerify the install:
./result/bin/discord-ptt-go helpIf you want a development shell instead:
nix-shell
go run . helpAfter a normal install:
~/.local/bin/discord-ptt-go setupAfter a Nix build:
./result/bin/discord-ptt-go setupFrom a dev shell:
go run . setupsetup prompts for the Discord shortcut, defaults to Shift + =, then waits for your button press and saves the detected values.
By default, the tool stores runtime state in:
./state
The directory may contain:
config.jsonconfig_detected.jsonshortcut_override.json
If you want to use another location:
~/.local/bin/discord-ptt-go setup --config-dir ~/.config/ptt-go
~/.local/bin/discord-ptt-go daemon --config-dir ~/.config/ptt-goAfter a normal install:
~/.local/bin/discord-ptt-go daemonAfter a Nix build:
./result/bin/discord-ptt-go daemonFrom a dev shell:
go run . daemonIf you want it to start automatically, create ~/.config/systemd/user/discord-ptt.service:
[Unit]
Description=Discord Mouse PTT
[Service]
ExecStart=%h/.local/bin/discord-ptt-go daemon --config-dir %h/.config/ptt-go
Restart=always
Environment=DISPLAY=:0
[Install]
WantedBy=default.targetIf you built the binary somewhere else, update ExecStart to match your real path.
Enable it:
systemctl --user daemon-reload
systemctl --user enable --now discord-ptt.serviceThis repo includes a Home Manager module:
./ptt.nix
Use this if you manage your desktop setup with Home Manager and want discord-ptt-go, its config files, and the helper scripts installed automatically instead of building and copying the binary by hand.
Add it to your Home Manager config, for example:
{
imports = [
./ptt.nix
];
}Apply Home Manager:
home-manager switchWhat ptt.nix does:
- Builds and installs
discord-ptt-go - Writes
~/.config/ptt-go/config.json - Seeds
~/.config/ptt-go/config_detected.json - Writes
~/.config/ptt-go/shortcut_override.json - Installs
~/.config/ptt-go/PTTManager.sh - Installs
~/.config/ptt-go/RofiPTT.sh
What it does not do:
- It does not auto-detect your mouse button during
home-manager switch - It does not start the daemon by itself until you run the helper scripts or wire it into your own startup flow
Recommended next step after enabling the module:
~/.config/ptt-go/PTTManager.sh setup
~/.config/ptt-go/PTTManager.sh startWhen using the Home Manager module, this repo generates:
~/.config/ptt-go/PTTManager.sh~/.config/ptt-go/RofiPTT.sh
Run it with:
~/.config/ptt-go/RofiPTT.shWhat it does:
- Start/stop/restart the PTT daemon
- Run setup to detect a mouse button
- View daemon logs
- Show a simple help entry
- Confirm the Discord keybind matches
DISCORD_SHORTCUTin your config. - Check the saved config:
go run . print-config- Make sure Discord is running with:
discord --enable-features=UseOzonePlatform --ozone-platform=x11- If the daemon starts but does not react to button presses, confirm your user can read the chosen input device.
- If you are using a custom config location, make sure you pass the same
--config-dirvalue to bothsetupanddaemon.
MIT. See LICENSE.