From 73827ce680ade02912abfd9408ce16476a28c796 Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Mon, 4 Sep 2017 16:46:06 +0200 Subject: [PATCH] Only dump configuration changes, not theme in `-dump-config`. --- doc/help-output.txt | 2 +- include/xrmoptions.h | 4 +++- source/rofi.c | 5 ++--- source/xrmoptions.c | 6 +++--- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/doc/help-output.txt b/doc/help-output.txt index a236659b..d89449e1 100644 --- a/doc/help-output.txt +++ b/doc/help-output.txt @@ -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) diff --git a/include/xrmoptions.h b/include/xrmoptions.h index 2d2f2b91..7bef1319 100644 --- a/include/xrmoptions.h +++ b/include/xrmoptions.h @@ -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 diff --git a/source/rofi.c b/source/rofi.c index fda23e4c..6ce618fa 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -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; } diff --git a/source/xrmoptions.c b/source/xrmoptions.c index 1eff4246..8434bc4e 100644 --- a/source/xrmoptions.c +++ b/source/xrmoptions.c @@ -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] ) ); } }