Skip to content

Instantly share code, notes, and snippets.

@jep-a
Last active February 12, 2021 23:51
Show Gist options
  • Save jep-a/a4e667edc4b2f62c57a265c720b3541a to your computer and use it in GitHub Desktop.
Save jep-a/a4e667edc4b2f62c57a265c720b3541a to your computer and use it in GitHub Desktop.
Autohotkey Mic Mute
#include %A_MyDocuments%\AutoHotkey\Lib\KeyboardLED.ahk
KEY_HOLD_DELAY := 250
MIC_ID := 13
MIC_CHECK_INTERVAL := 500
MIC_RELEASE_DELAY := 250
MicLEDFromSound()
{
global MIC_ID
SoundGet, muted, , MUTE, MIC_ID
KeyboardLED(4, muted != "On" ? "on" : "off", 0)
}
SetTimer, CheckMicLED, %MIC_CHECK_INTERVAL%
MicLEDFromSound()
F20::
F21::
{
global MIC_ID
SoundSet, +1, MASTER, MUTE, MIC_ID
MicLEDFromSound()
KeyWait, %A_ThisHotkey%
{
if (A_TimeSinceThisHotkey > KEY_HOLD_DELAY) {
Sleep, MIC_RELEASE_DELAY
SoundSet, +1, MASTER, MUTE, MIC_ID
MicLEDFromSound()
} else {
MicLEDFromSound()
}
}
return
}
CheckMicLED:
{
MicLEDFromSound()
return
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment