[client] keybind: add ScrollLock+C to cycle microphone defaults

This makes it possible to change the default action taken the next time
an application tries to open the microphone without restarting the
client.
This commit is contained in:
Quantum 2022-06-01 23:00:22 -04:00 committed by Geoffrey McRae
parent ae38db4915
commit eb1774f955
2 changed files with 24 additions and 0 deletions

View File

@ -139,6 +139,27 @@ void keybind_commonRegister(void)
"Toggle overlay"); "Toggle overlay");
} }
#if ENABLE_AUDIO
static void bind_toggleMicDefault(int sc, void * opaque)
{
g_state.micDefaultState = (g_state.micDefaultState + 1) % MIC_DEFAULT_MAX;
switch (g_state.micDefaultState)
{
case MIC_DEFAULT_PROMPT:
app_alert(LG_ALERT_INFO, "Microphone access will prompt");
break;
case MIC_DEFAULT_ALLOW:
app_alert(LG_ALERT_INFO, "Microphone access allowed by default");
break;
case MIC_DEFAULT_DENY:
app_alert(LG_ALERT_INFO, "Microphone access denied by default");
}
}
#endif
void keybind_spiceRegister(void) void keybind_spiceRegister(void)
{ {
/* register the common keybinds for spice */ /* register the common keybinds for spice */
@ -170,6 +191,8 @@ void keybind_spiceRegister(void)
{ {
app_registerKeybind(0, 'E', audio_recordToggleKeybind, NULL, app_registerKeybind(0, 'E', audio_recordToggleKeybind, NULL,
"Toggle audio recording"); "Toggle audio recording");
app_registerKeybind(0, 'C', bind_toggleMicDefault, NULL,
"Cycle audio recording default");
} }
#endif #endif

View File

@ -50,6 +50,7 @@ enum MicDefaultState {
MIC_DEFAULT_ALLOW, MIC_DEFAULT_ALLOW,
MIC_DEFAULT_DENY MIC_DEFAULT_DENY
}; };
#define MIC_DEFAULT_MAX (MIC_DEFAULT_DENY + 1)
struct AppState struct AppState
{ {