forked from enlightenment/enlightenment
mixer: Optionally select an external mixer application.
This feature allows to define an external mixer application, which replaces the internal mixer. Examples: 'terminology -e alsamixer', 'pavucontrol' @feature
This commit is contained in:
parent
c0e790dc5e
commit
97b1caef37
|
@ -75,6 +75,14 @@ _basic_apply(E_Config_Dialog *dialog, E_Config_Dialog_Data *cfdata)
|
|||
|
||||
conf->desktop_notification = ctxt->desktop_notification;
|
||||
conf->disable_pulse = ctxt->disable_pulse;
|
||||
|
||||
if ((ctxt->external_mixer_enabled) && (!strlen(ctxt->external_mixer_command)))
|
||||
return 0;
|
||||
conf->external_mixer_enabled = ctxt->external_mixer_enabled;
|
||||
if (conf->external_mixer_command)
|
||||
eina_stringshare_del(conf->external_mixer_command);
|
||||
if (ctxt->external_mixer_enabled)
|
||||
conf->external_mixer_command = eina_stringshare_add(ctxt->external_mixer_command);
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -85,7 +93,7 @@ _basic_create_general(E_Config_Dialog *dialog, Evas *evas, E_Config_Dialog_Data
|
|||
{
|
||||
struct mixer_config_ui_general *ui = &cfdata->ui.general;
|
||||
E_Mixer_Module_Context *ctxt = dialog->data;
|
||||
Evas_Object *label, *chk;
|
||||
Evas_Object *label, *chk, *edit;
|
||||
Eina_List *l;
|
||||
int i;
|
||||
|
||||
|
@ -116,15 +124,22 @@ _basic_create_general(E_Config_Dialog *dialog, Evas *evas, E_Config_Dialog_Data
|
|||
|
||||
e_widget_list_object_append(cfdata->ui.list, ui->frame, 1, 1, 0.5);
|
||||
chk = e_widget_check_add(evas, _("Display desktop notifications on volume change"), &ctxt->desktop_notification);
|
||||
e_widget_check_checked_set(chk, ctxt->conf->desktop_notification);
|
||||
e_widget_check_checked_set(chk, ctxt->desktop_notification);
|
||||
#ifndef HAVE_ENOTIFY
|
||||
e_widget_disabled_set(chk, EINA_TRUE);
|
||||
#endif
|
||||
e_widget_list_object_append(cfdata->ui.list, chk, 1, 1, 0.5);
|
||||
|
||||
chk = e_widget_check_add(evas, _("Disable PulseAudio"), &ctxt->disable_pulse);
|
||||
e_widget_check_checked_set(chk, ctxt->conf->disable_pulse);
|
||||
e_widget_check_checked_set(chk, ctxt->disable_pulse);
|
||||
e_widget_list_object_append(cfdata->ui.list, chk, 1, 1, 0.5);
|
||||
|
||||
chk = e_widget_check_add(evas, _("Enable external Mixer Command"), &ctxt->external_mixer_enabled);
|
||||
e_widget_check_checked_set(chk, ctxt->external_mixer_enabled);
|
||||
e_widget_list_object_append(cfdata->ui.list, chk, 1, 1, 0.5);
|
||||
|
||||
edit = e_widget_entry_add(evas, &ctxt->external_mixer_command, NULL, NULL, NULL);
|
||||
e_widget_list_object_append(cfdata->ui.list, edit, 1, 1, 0.5);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -146,6 +161,14 @@ cb_mixer_call(void *data, void *data2 __UNUSED__)
|
|||
return;
|
||||
}
|
||||
|
||||
if (ctxt->conf->external_mixer_enabled)
|
||||
{
|
||||
E_Zone *zone;
|
||||
zone = e_util_zone_current_get(e_manager_current_get());
|
||||
e_exec (zone, NULL, ctxt->conf->external_mixer_command, NULL, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
ctxt->mixer_dialog = e_mixer_app_dialog_new(NULL, cb_mixer_app_del, ctxt);
|
||||
|
||||
for (l = ctxt->instances; l; l = l->next)
|
||||
|
|
|
@ -188,6 +188,8 @@ _mixer_module_configuration_new(void)
|
|||
conf = E_NEW(E_Mixer_Module_Config, 1);
|
||||
conf->desktop_notification = 1;
|
||||
conf->disable_pulse = 0;
|
||||
conf->external_mixer_enabled = 0;
|
||||
conf->external_mixer_command = eina_stringshare_add("");
|
||||
|
||||
return conf;
|
||||
}
|
||||
|
@ -205,6 +207,9 @@ _mixer_module_configuration_free(E_Mixer_Module_Config *conf)
|
|||
eina_hash_free(conf->gadgets);
|
||||
}
|
||||
eina_stringshare_del(conf->default_gc_id);
|
||||
|
||||
if (conf->external_mixer_command)
|
||||
eina_stringshare_del(conf->external_mixer_command);
|
||||
free(conf);
|
||||
}
|
||||
|
||||
|
@ -506,6 +511,14 @@ _mixer_popup_cb_mixer(void *data, void *data2 __UNUSED__)
|
|||
return;
|
||||
}
|
||||
|
||||
if (ctxt->conf->external_mixer_enabled)
|
||||
{
|
||||
E_Zone *zone;
|
||||
zone = e_util_zone_current_get(e_manager_current_get());
|
||||
e_exec (zone, NULL, ctxt->conf->external_mixer_command, NULL, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
ctxt->mixer_dialog = e_mixer_app_dialog_new(NULL, _mixer_app_cb_del, ctxt);
|
||||
|
||||
_mixer_app_select_current(ctxt->mixer_dialog, inst);
|
||||
|
@ -1212,6 +1225,8 @@ _mixer_module_configuration_descriptor_new(E_Config_DD *gadget_conf_edd)
|
|||
E_CONFIG_HASH(conf_edd, E_Mixer_Module_Config, gadgets, gadget_conf_edd);
|
||||
E_CONFIG_VAL(conf_edd, E_Mixer_Module_Config, desktop_notification, INT);
|
||||
E_CONFIG_VAL(conf_edd, E_Mixer_Module_Config, disable_pulse, INT);
|
||||
E_CONFIG_VAL(conf_edd, E_Mixer_Module_Config, external_mixer_enabled, INT);
|
||||
E_CONFIG_VAL(conf_edd, E_Mixer_Module_Config, external_mixer_command, STR);
|
||||
|
||||
return conf_edd;
|
||||
}
|
||||
|
@ -1287,6 +1302,11 @@ _mixer_module_configuration_setup(E_Mixer_Module_Context *ctxt)
|
|||
ctxt->conf->version = MOD_CONFIG_FILE_VERSION;
|
||||
ctxt->desktop_notification = ctxt->conf->desktop_notification;
|
||||
ctxt->disable_pulse = ctxt->conf->disable_pulse;
|
||||
ctxt->external_mixer_enabled = ctxt->conf->external_mixer_enabled;
|
||||
if (ctxt->conf->external_mixer_command)
|
||||
ctxt->external_mixer_command = strdup(ctxt->conf->external_mixer_command);
|
||||
else
|
||||
ctxt->external_mixer_command = strdup("");
|
||||
}
|
||||
|
||||
static const char _act_increase[] = "volume_increase";
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
/* Increment for Major Changes */
|
||||
#define MOD_CONFIG_FILE_EPOCH 1
|
||||
/* Increment for Minor Changes (ie: user doesn't need a new config) */
|
||||
#define MOD_CONFIG_FILE_GENERATION 0
|
||||
#define MOD_CONFIG_FILE_GENERATION 1
|
||||
#define MOD_CONFIG_FILE_VERSION ((MOD_CONFIG_FILE_EPOCH * 1000000) + MOD_CONFIG_FILE_GENERATION)
|
||||
|
||||
typedef struct E_Mixer_Gadget_Config
|
||||
|
@ -31,6 +31,8 @@ typedef struct E_Mixer_Module_Config
|
|||
Eina_Hash *gadgets;
|
||||
int desktop_notification;
|
||||
int disable_pulse;
|
||||
int external_mixer_enabled;
|
||||
const char *external_mixer_command;
|
||||
} E_Mixer_Module_Config;
|
||||
|
||||
typedef struct E_Mixer_Instance
|
||||
|
@ -78,6 +80,8 @@ typedef struct E_Mixer_Module_Context
|
|||
} actions;
|
||||
int desktop_notification;
|
||||
int disable_pulse;
|
||||
int external_mixer_enabled;
|
||||
char *external_mixer_command;
|
||||
} E_Mixer_Module_Context;
|
||||
|
||||
EAPI extern E_Module_Api e_modapi;
|
||||
|
|
Loading…
Reference in New Issue