Allow combi modi to use scripts from the modi list.

fixes: #668
This commit is contained in:
Dave Davenport 2017-09-10 20:06:01 +02:00
parent 79f6cf2038
commit 56c373bffc
2 changed files with 10 additions and 1 deletions

View File

@ -125,7 +125,14 @@ static int combi_mode_init ( Mode *sw )
static unsigned int combi_mode_get_num_entries ( const Mode *sw )
{
const CombiModePrivateData *pd = (const CombiModePrivateData *) mode_get_private_data ( sw );
return pd->cmd_list_length;
unsigned int length = 0;
for ( unsigned int i = 0; i < pd->num_switchers; i++ ) {
unsigned int entries = mode_get_num_entries ( pd->switchers[i].mode );
pd->starts[i] = length;
pd->lengths[i] = entries;
length+=entries;
}
return length;
}
static void combi_mode_destroy ( Mode *sw )
{

View File

@ -579,6 +579,8 @@ static int add_mode ( const char * token )
// If not build in, use custom modi.
Mode *sw = script_switcher_parse_setup ( token );
if ( sw != NULL ) {
// Add to available list, so combi can find it.
rofi_collect_modi_add(sw);
modi[num_modi] = sw;
num_modi++;
}