1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-18 13:54:36 -05:00

[Helper] Add XDG_DATA_DIRS to theme search path. (#1619)

Issue: #1617
This commit is contained in:
Dave Davenport 2022-04-16 12:10:14 +02:00 committed by GitHub
parent e1955c0e33
commit 51c5beeb82
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1061,7 +1061,7 @@ char *helper_get_theme_path(const char *file, const char *ext) {
const char *cpath = g_get_user_config_dir();
if (cpath) {
char *themep = g_build_filename(cpath, "rofi", "themes", filename, NULL);
g_debug("Opening theme, testing: %s\n", themep);
g_debug("Opening theme, testing: %s", themep);
if (themep && g_file_test(themep, G_FILE_TEST_EXISTS)) {
g_free(filename);
return themep;
@ -1071,7 +1071,7 @@ char *helper_get_theme_path(const char *file, const char *ext) {
// Check config directory.
if (cpath) {
char *themep = g_build_filename(cpath, "rofi", filename, NULL);
g_debug("Opening theme, testing: %s\n", themep);
g_debug("Opening theme, testing: %s", themep);
if (g_file_test(themep, G_FILE_TEST_EXISTS)) {
g_free(filename);
return themep;
@ -1082,8 +1082,8 @@ char *helper_get_theme_path(const char *file, const char *ext) {
if (datadir) {
char *theme_path =
g_build_filename(datadir, "rofi", "themes", filename, NULL);
g_debug("Opening theme, testing: %s\n", theme_path);
if (theme_path) {
g_debug("Opening theme, testing: %s", theme_path);
if (g_file_test(theme_path, G_FILE_TEST_EXISTS)) {
g_free(filename);
return theme_path;
@ -1092,9 +1092,26 @@ char *helper_get_theme_path(const char *file, const char *ext) {
}
}
const gchar * const * system_data_dirs = g_get_system_data_dirs ();
if ( system_data_dirs ) {
for ( uint_fast32_t i = 0; system_data_dirs[i] != NULL; i++ ){
const char * const datadir = system_data_dirs[i];
g_debug("Opening theme directory: %s", datadir );
char *theme_path = g_build_filename(datadir, "rofi", "themes", filename, NULL);
if (theme_path) {
g_debug("Opening theme, testing: %s", theme_path);
if (g_file_test(theme_path, G_FILE_TEST_EXISTS)) {
g_free(filename);
return theme_path;
}
g_free(theme_path);
}
}
}
char *theme_path = g_build_filename(THEME_DIR, filename, NULL);
if (theme_path) {
g_debug("Opening theme, testing: %s\n", theme_path);
g_debug("Opening theme, testing: %s", theme_path);
if (g_file_test(theme_path, G_FILE_TEST_EXISTS)) {
g_free(filename);
return theme_path;