feat: add enable/disable keyboard and mouse sounds with CLI options and config file
This commit is contained in:
12 files changed
+298
-199
No files matched your search
+19
-9
@@ -12,20 +12,22 @@ int handle_reload(const char *user_cfg_path, char *current_sound_name,
|
||||
char *current_sound_dir, char *current_mouse_config_path,
|
||||
char *current_mouse_sound_dir, int current_mute,
|
||||
int current_verbose, int current_mouse_volume_arg,
|
||||
int current_keyboard_mute, int current_mouse_mute) {
|
||||
int current_keyboard_mute, int current_mouse_mute,
|
||||
int *current_keyboard_enabled, int *current_mouse_enabled) {
|
||||
char *cfg_keyboard_sound = NULL;
|
||||
char *cfg_mouse_sound = NULL;
|
||||
int cfg_keyboard_volume = *current_keyboard_volume;
|
||||
int cfg_mouse_volume = *current_mouse_volume;
|
||||
int cfg_keyboard_enabled = *current_keyboard_enabled;
|
||||
int cfg_mouse_enabled = *current_mouse_enabled;
|
||||
if (read_user_config(user_cfg_path, &cfg_keyboard_sound, &cfg_mouse_sound,
|
||||
&cfg_keyboard_volume, &cfg_mouse_volume)) {
|
||||
printf("Read config - keyboard:%s mouse:%s kvol:%d mvol:%d (current "
|
||||
"kvol:%d mvol:%d)\n",
|
||||
&cfg_keyboard_volume, &cfg_mouse_volume, &cfg_keyboard_enabled, &cfg_mouse_enabled)) {
|
||||
printf("Read config - keyboard:%s mouse:%s kvol:%d mvol:%d kenabled:%d menabled:%d\n",
|
||||
cfg_keyboard_sound ? cfg_keyboard_sound : "NULL",
|
||||
cfg_mouse_sound ? cfg_mouse_sound : "NULL", cfg_keyboard_volume,
|
||||
cfg_mouse_volume, *current_keyboard_volume, *current_mouse_volume);
|
||||
cfg_mouse_volume, cfg_keyboard_enabled, cfg_mouse_enabled);
|
||||
int keyboard_changed = 0, mouse_changed = 0, keyboard_volume_changed = 0,
|
||||
mouse_volume_changed = 0;
|
||||
mouse_volume_changed = 0, keyboard_enabled_changed = 0, mouse_enabled_changed = 0;
|
||||
if (cfg_keyboard_sound &&
|
||||
strcmp(current_sound_name, cfg_keyboard_sound) != 0) {
|
||||
keyboard_changed = 1;
|
||||
@@ -48,11 +50,19 @@ int handle_reload(const char *user_cfg_path, char *current_sound_name,
|
||||
mouse_volume_changed = 1;
|
||||
*current_mouse_volume = cfg_mouse_volume;
|
||||
}
|
||||
printf("Config changed - keyboard:%d mouse:%d kvol:%d mvol:%d\n",
|
||||
if (cfg_keyboard_enabled != *current_keyboard_enabled) {
|
||||
keyboard_enabled_changed = 1;
|
||||
*current_keyboard_enabled = cfg_keyboard_enabled;
|
||||
}
|
||||
if (cfg_mouse_enabled != *current_mouse_enabled) {
|
||||
mouse_enabled_changed = 1;
|
||||
*current_mouse_enabled = cfg_mouse_enabled;
|
||||
}
|
||||
printf("Config changed - keyboard:%d mouse:%d kvol:%d mvol:%d kenabled:%d menabled:%d\n",
|
||||
keyboard_changed, mouse_changed, keyboard_volume_changed,
|
||||
mouse_volume_changed);
|
||||
mouse_volume_changed, keyboard_enabled_changed, mouse_enabled_changed);
|
||||
if (keyboard_changed || mouse_changed || keyboard_volume_changed ||
|
||||
mouse_volume_changed) {
|
||||
mouse_volume_changed || keyboard_enabled_changed || mouse_enabled_changed) {
|
||||
int keyboard_valid = validate_keyboard_sound_pack(current_sound_name);
|
||||
int mouse_valid = validate_mouse_sound_pack(current_mouse_sound_name);
|
||||
if (keyboard_valid && mouse_valid) {
|
||||
|
||||
Reference in new issue
Block a user