05-03-26
Mouse Side Button Push-to-Talk Script
This Lua script for Rebind hardware input enables push-to-talk functionality using your mouse side button. It toggles the mute state of your microphone using a configurable hotkey, making it easy to c
Question
Mouse side button push-to-talk
Rebind AI
-- rebind: name=Push-to-Talk (Mouse Side Button)
-- rebind: description=Hold Mouse4 to activate microphone, release to mute
local cfg = UI.Schema({
hotkey = UI.Keybind("Mouse4", { label = "PTT Key" }),
mute_key = UI.Keybind("LCtrl+LAlt+M", { label = "Mute Toggle (Discord/Teams)" }),
})
function OnDown(key)
if key == cfg.hotkey then
-- Activate microphone by pressing the mute toggle
-- (assumes Discord/Teams where Ctrl+Alt+M toggles mute)
HID.Press(cfg.mute_key, 50)
return false
end
return true
end
function OnUp(key)
if key == cfg.hotkey then
-- Deactivate microphone
HID.Press(cfg.mute_key, 50)
return false
end
return true
endHow it works:
This script maps Mouse4 (back button) to push-to-talk by toggling the mute state. When you press Mouse4, it unmutes your microphone. When you release Mouse4, it mutes again.
The script sends the mute toggle hotkey (configurable, defaults to Ctrl+Alt+M which works in Discord and Microsoft Teams) on both press and release. This works because:
- Press: Mute is ON → toggle → Mute is OFF (you're live)
- Release: Mute is OFF → toggle → Mute is ON (you're silent)
If your app uses a different mute hotkey, change the mute_key config. Some apps:
- Discord/Teams:
LCtrl+LAlt+M - Slack:
LCtrl+LAlt+Space - OBS:
LCtrl+LAlt+O(if configured)
The script blocks Mouse4 from reaching your PC, so it won't trigger any other application behavior.
Learn more