diff --git a/source/rofi.c b/source/rofi.c index 5b85763d..3bf42b58 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -542,7 +542,6 @@ static int add_mode ( const char * token ) Mode *sw = script_switcher_parse_setup ( token ); if ( sw != NULL ) { modi[num_modi] = sw; - mode_set_config ( sw ); num_modi++; } else { @@ -564,36 +563,6 @@ static void setup_modi ( void ) } // Free string that was modified by strtok_r g_free ( switcher_str ); - rofi_collect_modi_setup (); -} - -/** - * Load configuration. - * Following priority: (current), X, commandline arguments - */ -static inline void load_configuration ( ) -{ - // Load distro default settings - gchar *etc = g_build_filename ( SYSCONFDIR, "rofi.conf", NULL ); - if ( g_file_test ( etc, G_FILE_TEST_IS_REGULAR ) ) { - config_parse_xresource_options_file ( etc ); - } - g_free ( etc ); - // Load in config from X resources. - config_parse_xresource_options ( xcb ); - config_parse_xresource_options_file ( config_path ); -} -static inline void load_configuration_dynamic ( ) -{ - // Load distro default settings - gchar *etc = g_build_filename ( SYSCONFDIR, "rofi.conf", NULL ); - if ( g_file_test ( etc, G_FILE_TEST_IS_REGULAR ) ) { - config_parse_xresource_options_dynamic_file ( etc ); - } - g_free ( etc ); - // Load in config from X resources. - config_parse_xresource_options_dynamic ( xcb ); - config_parse_xresource_options_dynamic_file ( config_path ); } /** @@ -938,6 +907,7 @@ int main ( int argc, char *argv[] ) TICK_N ( "Open Display" ); rofi_collect_modi (); + rofi_collect_modi_setup (); TICK_N ( "Collect MODI" ); xcb->screen = xcb_aux_get_screen ( xcb->connection, xcb->screen_nbr ); @@ -1071,10 +1041,34 @@ int main ( int argc, char *argv[] ) TICK_N ( "Setup abe" ); if ( find_arg ( "-no-config" ) < 0 ) { - load_configuration ( ); + // Load distro default settings + gchar *etc = g_build_filename ( SYSCONFDIR, "rofi.conf", NULL ); + if ( g_file_test ( etc, G_FILE_TEST_IS_REGULAR ) ) { + config_parse_xresource_options_file ( etc ); + config_parse_xresource_options_dynamic_file ( etc ); + } + g_free ( etc ); + // Load in config from X resources. + config_parse_xresource_options ( xcb ); + config_parse_xresource_options_dynamic ( xcb ); + config_parse_xresource_options_file ( config_path ); + config_parse_xresource_options_dynamic_file ( config_path ); + + find_arg_str ( "-theme", &(config.theme)); + if ( config.theme ) { + TICK_N ( "Parse theme" ); + if ( rofi_theme_parse_file ( config.theme ) ) { + // TODO: instantiate fallback theme.? + rofi_theme_free ( rofi_theme ); + rofi_theme = NULL; + } + TICK_N ( "Parsed theme" ); + } } // Parse command line for settings, independent of other -no-config. config_parse_cmd_options ( ); + config_parse_cmd_options_dynamic ( ); + TICK_N ( "Load cmd config " ); if ( !dmenu_mode ) { // setup_modi @@ -1082,24 +1076,6 @@ int main ( int argc, char *argv[] ) TICK_N ( "Setup Modi" ); } - if ( find_arg ( "-no-config" ) < 0 ) { - // Reload for dynamic part. - load_configuration_dynamic ( ); - TICK_N ( "Load config dynamic" ); - } - // Parse command line for settings, independent of other -no-config. - config_parse_cmd_options_dynamic ( ); - TICK_N ( "Load cmd config dynamic" ); - - if ( config.theme ) { - TICK_N ( "Parse theme" ); - if ( rofi_theme_parse_file ( config.theme ) ) { - // TODO: instantiate fallback theme.? - rofi_theme_free ( rofi_theme ); - rofi_theme = NULL; - } - TICK_N ( "Parsed theme" ); - } const char ** theme_str = find_arg_strv ( "-theme-str" ); if ( theme_str ) {