Only dump configuration changes, not theme in `-dump-config`.

This commit is contained in:
Dave Davenport 2017-09-04 16:46:06 +02:00
parent 2d586a47df
commit 73827ce680
4 changed files with 9 additions and 8 deletions

View File

@ -15,7 +15,7 @@ Command line only options:
-show [mode] Show the mode 'mode' and exit. The mode has to be enabled.
-no-lazy-grab Disable lazy grab that, when fail to grab keyboard, does not block but retry later.
-no-plugins Disable loading of external plugins.
-dump-config Dump the current configuration and theme in rasi format and exit.
-dump-config Dump the current configuration in rasi format and exit.
-dump-theme Dump the current theme in rasi format and exit.
DMENU command line options:
-mesg [string] Print a small user message under the prompt (uses pango markup)

View File

@ -167,8 +167,10 @@ char ** config_parser_return_display_help ( unsigned int *length );
gboolean config_parse_set_property ( const Property *p, char **error );
/**
* @param changes Only print the changed options.
*
* @brief Dump configuration in rasi format.
*/
void config_parse_dump_config_rasi_format ( void );
void config_parse_dump_config_rasi_format ( gboolean changes );
/* @}*/
#endif

View File

@ -267,7 +267,7 @@ static void print_main_application_options ( int is_term )
print_help_msg ( "-show", "[mode]", "Show the mode 'mode' and exit. The mode has to be enabled.", NULL, is_term );
print_help_msg ( "-no-lazy-grab", "", "Disable lazy grab that, when fail to grab keyboard, does not block but retry later.", NULL, is_term );
print_help_msg ( "-no-plugins", "", "Disable loading of external plugins.", NULL, is_term );
print_help_msg ( "-dump-config", "", "Dump the current configuration and theme in rasi format and exit.", NULL, is_term );
print_help_msg ( "-dump-config", "", "Dump the current configuration in rasi format and exit.", NULL, is_term );
print_help_msg ( "-dump-theme", "", "Dump the current theme in rasi format and exit.", NULL, is_term );
}
static void help ( G_GNUC_UNUSED int argc, char **argv )
@ -909,8 +909,7 @@ int main ( int argc, char *argv[] )
return EXIT_SUCCESS;
}
if ( find_arg ( "-dump-config" ) >= 0 ) {
config_parse_dump_config_rasi_format ( );
rofi_theme_print ( rofi_theme );
config_parse_dump_config_rasi_format ( TRUE );
cleanup ();
return EXIT_SUCCESS;
}

View File

@ -592,7 +592,7 @@ static void config_parse_dump_config_option ( XrmOption *option )
printf ( "\n" );
}
void config_parse_dump_config_rasi_format ( void )
void config_parse_dump_config_rasi_format ( gboolean changes )
{
printf ( "configuration {\n" );
@ -604,12 +604,12 @@ void config_parse_dump_config_rasi_format ( void )
continue;
}
}
if ( xrmOptions[i].source != CONFIG_DEFAULT ) {
if ( !changes || xrmOptions[i].source != CONFIG_DEFAULT ) {
config_parse_dump_config_option ( &( xrmOptions[i] ) );
}
}
for ( unsigned int i = 0; i < num_extra_options; i++ ) {
if ( extra_options[i].source != CONFIG_DEFAULT ) {
if ( !changes || extra_options[i].source != CONFIG_DEFAULT ) {
config_parse_dump_config_option ( &( extra_options[i] ) );
}
}