diff --git a/src/config.c b/src/config.c index e4ad23f..079b7a2 100644 --- a/src/config.c +++ b/src/config.c @@ -635,8 +635,9 @@ void add_entry (char *key, char *value) } else if (strcmp(key, "launcher_icon_theme") == 0) { // if XSETTINGS manager running, tint2 use it. - if (!icon_theme_name) - icon_theme_name = strdup(value); + if (icon_theme_name_config) + free(icon_theme_name_config); + icon_theme_name_config = strdup(value); } else if (strcmp(key, "launcher_icon_asb") == 0) { extract_values(value, &value1, &value2, &value3); diff --git a/src/launcher/launcher.c b/src/launcher/launcher.c index 0843c8f..59ff335 100644 --- a/src/launcher/launcher.c +++ b/src/launcher/launcher.c @@ -52,7 +52,8 @@ int launcher_tooltip_enabled; int launcher_alpha; int launcher_saturation; int launcher_brightness; -char *icon_theme_name; +char *icon_theme_name_config; +char *icon_theme_name_xsettings; XSettingsClient *xsettings_client; Imlib_Image scale_icon(Imlib_Image original, int icon_size); @@ -66,7 +67,8 @@ void default_launcher() launcher_alpha = 100; launcher_saturation = 0; launcher_brightness = 0; - icon_theme_name = NULL; + icon_theme_name_config = NULL; + icon_theme_name_xsettings = NULL; xsettings_client = NULL; } @@ -124,8 +126,10 @@ void cleanup_launcher() } g_slist_free(panel_config.launcher.list_apps); panel_config.launcher.list_apps = NULL; - free(icon_theme_name); - icon_theme_name = NULL; + free(icon_theme_name_config); + icon_theme_name_config = NULL; + free(icon_theme_name_xsettings); + icon_theme_name_xsettings = NULL; launcher_enabled = 0; } @@ -474,5 +478,9 @@ void launcher_load_icons(Launcher *launcher) // Populates the list_themes list void launcher_load_themes(Launcher *launcher) { - launcher->list_themes = load_themes(icon_theme_name); + launcher->list_themes = load_themes(icon_theme_name_config + ? icon_theme_name_config + : icon_theme_name_xsettings + ? icon_theme_name_xsettings + : "hicolor"); } diff --git a/src/launcher/launcher.h b/src/launcher/launcher.h index eef4cfe..b90ed1c 100644 --- a/src/launcher/launcher.h +++ b/src/launcher/launcher.h @@ -40,7 +40,8 @@ extern int launcher_tooltip_enabled; extern int launcher_alpha; extern int launcher_saturation; extern int launcher_brightness; -extern char *icon_theme_name; // theme name +extern char *icon_theme_name_xsettings; // theme name +extern char *icon_theme_name_config; extern XSettingsClient *xsettings_client; // default global data diff --git a/src/launcher/xsettings-client.c b/src/launcher/xsettings-client.c index ab77b74..23c0efa 100644 --- a/src/launcher/xsettings-client.c +++ b/src/launcher/xsettings-client.c @@ -51,12 +51,12 @@ void xsettings_notify_cb (const char *name, XSettingsAction action, XSettingsSet //printf("xsettings_notify_cb\n"); if ((action == XSETTINGS_ACTION_NEW || action == XSETTINGS_ACTION_CHANGED) && name != NULL && setting != NULL) { if (!strcmp(name, "Net/IconThemeName") && setting->type == XSETTINGS_TYPE_STRING) { - if (icon_theme_name) { - if (strcmp(icon_theme_name, setting->data.v_string) == 0) + if (icon_theme_name_xsettings) { + if (strcmp(icon_theme_name_xsettings, setting->data.v_string) == 0) return; - free(icon_theme_name); + free(icon_theme_name_xsettings); } - icon_theme_name = strdup(setting->data.v_string); + icon_theme_name_xsettings = strdup(setting->data.v_string); int i; for (i = 0 ; i < nb_panel ; i++) { diff --git a/src/tint2conf/properties.c b/src/tint2conf/properties.c index 1348954..d05f50f 100644 --- a/src/tint2conf/properties.c +++ b/src/tint2conf/properties.c @@ -1867,6 +1867,7 @@ void create_launcher(GtkWidget *parent) load_desktop_files(path); g_free(path); + icon_theme_changed(); load_icons(launcher_apps); load_icons(all_apps); fprintf(stderr, "Desktop files loaded\n"); fflush(stderr); diff --git a/src/tint2conf/properties_rw.c b/src/tint2conf/properties_rw.c index e950f62..cd064cf 100644 --- a/src/tint2conf/properties_rw.c +++ b/src/tint2conf/properties_rw.c @@ -387,7 +387,7 @@ void config_write_launcher(FILE *fp) fprintf(fp, "launcher_background_id = %d\n", 1 + gtk_combo_box_get_active(GTK_COMBO_BOX(launcher_background))); fprintf(fp, "launcher_icon_size = %d\n", (int)gtk_spin_button_get_value(GTK_SPIN_BUTTON(launcher_icon_size))); gchar *icon_theme = get_current_icon_theme(); - if (icon_theme) { + if (icon_theme && !g_str_equal(icon_theme, "")) { fprintf(fp, "launcher_icon_theme = %s\n", icon_theme); g_free(icon_theme); icon_theme = NULL;