diff --git a/include/helper.h b/include/helper.h index 110469c5..6204776a 100644 --- a/include/helper.h +++ b/include/helper.h @@ -380,6 +380,17 @@ void rofi_output_formatted_line ( const char *format, const char *string, int se * @returns a new string with the keys replaced. */ char *helper_string_replace_if_exists ( char * string, ... ); + +/** + * @param file File name passed to option. + * @param ext File extension passed to option. + * + * @returns path to theme or copy of filename if not found. + */ +char *helper_get_theme_path ( const char *file, const char *ext ); + + + G_END_DECLS /**@} */ diff --git a/include/theme.h b/include/theme.h index 0b2dd5b9..863e5b32 100644 --- a/include/theme.h +++ b/include/theme.h @@ -375,12 +375,6 @@ gboolean rofi_theme_is_empty ( void ); */ void rofi_theme_reset ( void ); -/** - * @param file File name passed to option. - * - * @returns path to theme or copy of filename if not found. - */ -char *helper_get_theme_path ( const char *file ); /** * @param file File name to prepare. diff --git a/lexer/theme-lexer.l b/lexer/theme-lexer.l index 3f3dab8a..4f288454 100644 --- a/lexer/theme-lexer.l +++ b/lexer/theme-lexer.l @@ -367,7 +367,7 @@ if ( queue == NULL ) { yytext[yyleng-1] = '\0'; ParseObject *top = g_queue_peek_head ( file_queue ); g_assert ( top != NULL ); - char *file2 = helper_get_theme_path ( &yytext[1] ); + char *file2 = helper_get_theme_path ( &yytext[1], ".rasi" ); char *filename = rofi_theme_parse_prepare_file ( file2, top->filename ); g_free ( file2 ); if ( g_list_find_custom ( imported_files, filename, (GCompareFunc)g_strcmp0 ) != NULL ) { @@ -778,7 +778,7 @@ if ( queue == NULL ) { gboolean rofi_theme_parse_file ( const char *file ) { - char *file2 = helper_get_theme_path ( file ); + char *file2 = helper_get_theme_path ( file, ".rasi" ); char *filename = rofi_theme_parse_prepare_file ( file2, NULL ); g_free ( file2 ); diff --git a/source/helper.c b/source/helper.c index 771522a9..d0b65934 100644 --- a/source/helper.c +++ b/source/helper.c @@ -1054,7 +1054,7 @@ gboolean helper_execute_command ( const char *wd, const char *cmd, gboolean run_ return helper_execute ( wd, args, "", cmd, context ); } -char *helper_get_theme_path ( const char *file ) +char *helper_get_theme_path ( const char *file, const char *ext ) { char *filename = rofi_expand_path ( file ); g_debug ( "Opening theme, testing: %s\n", filename ); @@ -1063,11 +1063,11 @@ char *helper_get_theme_path ( const char *file ) } g_free ( filename ); - if ( g_str_has_suffix ( file, ".rasi" ) ) { + if ( g_str_has_suffix ( file, ext ) ) { filename = g_strdup ( file ); } else { - filename = g_strconcat ( file, ".rasi", NULL ); + filename = g_strconcat ( file, ext, NULL ); } // Check config's themes directory. const char *cpath = g_get_user_config_dir (); diff --git a/source/rofi-icon-fetcher.c b/source/rofi-icon-fetcher.c index a4790639..57c671d3 100644 --- a/source/rofi-icon-fetcher.c +++ b/source/rofi-icon-fetcher.c @@ -46,6 +46,7 @@ #include #include +#include "helper.h" typedef struct { @@ -305,7 +306,15 @@ static void rofi_icon_fetcher_worker ( thread_state *sdata, G_GNUC_UNUSED gpoint icon_path = icon_path_ = nk_xdg_theme_get_icon ( rofi_icon_fetcher_data->xdg_context, themes, NULL, sentry->entry->name, MIN(sentry->wsize,sentry->hsize), 1, TRUE ); if ( icon_path_ == NULL ) { g_debug ( "failed to get icon %s(%dx%d): n/a", sentry->entry->name, sentry->wsize, sentry->hsize ); - return; + + const char *ext = g_strrstr(sentry->entry->name, "."); + if ( ext ) { +printf("%s %s\r\n", sentry->entry->name, ext); + icon_path = helper_get_theme_path ( sentry->entry->name, ext ); + } + if ( icon_path == NULL ) { + return; + } } else{ g_debug ( "found icon %s(%dx%d): %s", sentry->entry->name, sentry->wsize, sentry->hsize, icon_path ); diff --git a/test/box-test.c b/test/box-test.c index 53afcceb..af309f9c 100644 --- a/test/box-test.c +++ b/test/box-test.c @@ -93,7 +93,7 @@ char * rofi_expand_path ( G_GNUC_UNUSED const char *path ) return NULL; } -char * helper_get_theme_path ( const char *file ) +char * helper_get_theme_path ( const char *file, const char *ext) { return g_strdup ( file ); } diff --git a/test/scrollbar-test.c b/test/scrollbar-test.c index 4604851b..60a90172 100644 --- a/test/scrollbar-test.c +++ b/test/scrollbar-test.c @@ -78,7 +78,7 @@ int monitor_active ( G_GNUC_UNUSED workarea *mon ) return 0; } -char * helper_get_theme_path ( const char *file ) +char * helper_get_theme_path ( const char *file, const char *ext ) { return g_strdup ( file ); }