From 594c7f2b31a3993318b7457ec7c19738873eade7 Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Fri, 26 Aug 2022 14:05:16 +0200 Subject: [PATCH] [Theme] If no theme loaded, load default. Downgrade missing theme file to warning. Issue: #1689 --- lexer/theme-lexer.l | 2 +- source/rofi.c | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lexer/theme-lexer.l b/lexer/theme-lexer.l index 96407443..0763b22e 100644 --- a/lexer/theme-lexer.l +++ b/lexer/theme-lexer.l @@ -433,7 +433,7 @@ if ( queue == NULL ) { } else { char *str = g_markup_printf_escaped ( "Failed to open theme: %s\nError: %s", filename, strerror ( errno ) ); - rofi_add_error_message ( g_string_new ( str ) ); + rofi_add_warning_message ( g_string_new ( str ) ); g_free ( str ); g_free(filename); } diff --git a/source/rofi.c b/source/rofi.c index a7edb5cb..fd318ad2 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -36,12 +36,12 @@ #include #include #include +#include #include #include #include #include #include -#include #include @@ -1017,6 +1017,11 @@ int main(int argc, char *argv[]) { // This might clear existing errors. config_parse_cmd_options(); } + + if (rofi_theme == NULL || rofi_theme->num_widgets == 0) { + g_warning("Failed to load theme. Try to load default: "); + rofi_theme_parse_string("@theme \"default\""); + } TICK_N("Load cmd config "); // Get the path to the cache dir.