- char *value1=0, *value2=0;
-
- /* Background and border */
- if (strcmp (key, "rounded") == 0) {
- // 'rounded' is the first parameter => alloc a new background
- Area *back = calloc(1, sizeof(Area));
- back->border.rounded = atoi (value);
- list_back = g_slist_append(list_back, back);
- }
- else if (strcmp (key, "border_width") == 0) {
- Area *back = g_slist_last(list_back)->data;
- back->border.width = atoi (value);
- }
- else if (strcmp (key, "background_color") == 0) {
- Area *back = g_slist_last(list_back)->data;
- extract_values(value, &value1, &value2);
- get_color (value1, back->back.color);
- if (value2) back->back.alpha = (atoi (value2) / 100.0);
- else back->back.alpha = 0.5;
- }
- else if (strcmp (key, "border_color") == 0) {
- Area *back = g_slist_last(list_back)->data;
- extract_values(value, &value1, &value2);
- get_color (value1, back->border.color);
- if (value2) back->border.alpha = (atoi (value2) / 100.0);
- else back->border.alpha = 0.5;
- }
-
- /* Panel */
- else if (strcmp (key, "panel_monitor") == 0) {
- panel.monitor = atoi (value);
- if (panel.monitor > 0) panel.monitor -= 1;
- }
- else if (strcmp (key, "panel_size") == 0) {
- extract_values(value, &value1, &value2);
- panel.area.width = atoi (value1);
- if (value2) panel.area.height = atoi (value2);
- }
- else if (strcmp (key, "panel_margin") == 0) {
- extract_values(value, &value1, &value2);
- panel.marginx = atoi (value1);
- if (value2) panel.marginy = atoi (value2);
- }
- else if (strcmp (key, "panel_padding") == 0) {
- extract_values(value, &value1, &value2);
- panel.area.paddingx = atoi (value1);
- if (value2) panel.area.paddingy = atoi (value2);
- }
- else if (strcmp (key, "panel_position") == 0) {
- extract_values(value, &value1, &value2);
- if (strcmp (value1, "top") == 0) panel.position = TOP;
- else panel.position = BOTTOM;
-
- if (!value2) panel.position = CENTER;
- else {
- if (strcmp (value2, "left") == 0) panel.position |= LEFT;
- else {
- if (strcmp (value2, "right") == 0) panel.position |= RIGHT;
- else panel.position |= CENTER;
- }
- }
- }
- else if (strcmp (key, "font_shadow") == 0)
- g_task.font_shadow = atoi (value);
- else if (strcmp (key, "panel_background_id") == 0) {
- int id = atoi (value);
- Area *back = g_slist_nth_data(list_back, id);
- memcpy(&panel.area.back, &back->back, sizeof(Color));
- memcpy(&panel.area.border, &back->border, sizeof(Border));
- }
-
- /* Clock */
- else if (strcmp (key, "time1_format") == 0) {
- if (panel.clock.time1_format) g_free(panel.clock.time1_format);
- if (strlen(value) > 0) panel.clock.time1_format = strdup (value);
- else panel.clock.time1_format = 0;
- }
- else if (strcmp (key, "time2_format") == 0) {
- if (panel.clock.time2_format) g_free(panel.clock.time2_format);
- if (strlen(value) > 0) panel.clock.time2_format = strdup (value);
- else panel.clock.time2_format = 0;
- }
- else if (strcmp (key, "time1_font") == 0) {
- if (panel.clock.time1_font_desc) pango_font_description_free(panel.clock.time1_font_desc);
- panel.clock.time1_font_desc = pango_font_description_from_string (value);
- }
- else if (strcmp (key, "time2_font") == 0) {
- if (panel.clock.time2_font_desc) pango_font_description_free(panel.clock.time2_font_desc);
- panel.clock.time2_font_desc = pango_font_description_from_string (value);
- }
- else if (strcmp (key, "clock_font_color") == 0) {
- extract_values(value, &value1, &value2);
- get_color (value1, panel.clock.font.color);
- if (value2) panel.clock.font.alpha = (atoi (value2) / 100.0);
- else panel.clock.font.alpha = 0.1;
- }
- else if (strcmp (key, "clock_padding") == 0) {
- extract_values(value, &value1, &value2);
- panel.clock.area.paddingx = atoi (value1);
- if (value2) panel.clock.area.paddingy = atoi (value2);
- }
- else if (strcmp (key, "clock_background_id") == 0) {
- int id = atoi (value);
- Area *back = g_slist_nth_data(list_back, id);
- memcpy(&panel.clock.area.back, &back->back, sizeof(Color));
- memcpy(&panel.clock.area.border, &back->border, sizeof(Border));
- }
-
- /* Taskbar */
- else if (strcmp (key, "taskbar_mode") == 0) {
- if (strcmp (value, "multi_desktop") == 0) panel.mode = MULTI_DESKTOP;
- else if (strcmp (value, "multi_monitor") == 0) panel.mode = MULTI_MONITOR;
- else panel.mode = SINGLE_DESKTOP;
- }
- else if (strcmp (key, "taskbar_padding") == 0) {
- extract_values(value, &value1, &value2);
- g_taskbar.paddingx = atoi (value1);
- if (value2) g_taskbar.paddingy = atoi (value2);
- }
- else if (strcmp (key, "taskbar_background_id") == 0) {
- int id = atoi (value);
- Area *back = g_slist_nth_data(list_back, id);
- memcpy(&g_taskbar.back, &back->back, sizeof(Color));
- memcpy(&g_taskbar.border, &back->border, sizeof(Border));
- }
-
- /* Task */
- else if (strcmp (key, "task_text") == 0)
- g_task.text = atoi (value);
- else if (strcmp (key, "task_icon") == 0)
- g_task.icon = atoi (value);
- else if (strcmp (key, "task_centered") == 0)
- g_task.centered = atoi (value);
- else if (strcmp (key, "task_width") == 0)
- g_task.maximum_width = atoi (value);
- else if (strcmp (key, "task_padding") == 0) {
- extract_values(value, &value1, &value2);
- g_task.area.paddingx = atoi (value1);
- g_task.area_active.paddingx = atoi (value1);
- if (value2) {
- g_task.area.paddingy = atoi (value2);
- g_task.area_active.paddingy = atoi (value2);
- }
- }
- else if (strcmp (key, "task_font") == 0) {
- if (g_task.font_desc) pango_font_description_free(g_task.font_desc);
- g_task.font_desc = pango_font_description_from_string (value);
- }
- else if (strcmp (key, "task_font_color") == 0) {
- extract_values(value, &value1, &value2);
- get_color (value1, g_task.font.color);
- if (value2) g_task.font.alpha = (atoi (value2) / 100.0);
- else g_task.font.alpha = 0.1;
- }
- else if (strcmp (key, "task_active_font_color") == 0) {
- extract_values(value, &value1, &value2);
- get_color (value1, g_task.font_active.color);
- if (value2) g_task.font_active.alpha = (atoi (value2) / 100.0);
- else g_task.font_active.alpha = 0.1;
- }
- else if (strcmp (key, "task_background_id") == 0) {
- int id = atoi (value);
- Area *back = g_slist_nth_data(list_back, id);
- memcpy(&g_task.area.back, &back->back, sizeof(Color));
- memcpy(&g_task.area.border, &back->border, sizeof(Border));
- }
- else if (strcmp (key, "task_active_background_id") == 0) {
- int id = atoi (value);
- Area *back = g_slist_nth_data(list_back, id);
- memcpy(&g_task.area_active.back, &back->back, sizeof(Color));
- memcpy(&g_task.area_active.border, &back->border, sizeof(Border));
- }
-
- /* Mouse actions */
- else if (strcmp (key, "mouse_middle") == 0)
- get_action (value, &panel.mouse_middle);
- else if (strcmp (key, "mouse_right") == 0)
- get_action (value, &panel.mouse_right);
- else if (strcmp (key, "mouse_scroll_up") == 0)
- get_action (value, &panel.mouse_scroll_up);
- else if (strcmp (key, "mouse_scroll_down") == 0)
- get_action (value, &panel.mouse_scroll_down);
-
-
- /* Read old config for backward compatibility */
- else if (strcmp (key, "font") == 0) {
- panel.old_config_file = 1;
- if (g_task.font_desc) pango_font_description_free(g_task.font_desc);
- g_task.font_desc = pango_font_description_from_string (value);
- if (panel.old_task_font) free(panel.old_task_font);
- panel.old_task_font = strdup (value);
- }
- else if (strcmp (key, "font_color") == 0)
- get_color (value, g_task.font.color);
- else if (strcmp (key, "font_alpha") == 0)
- g_task.font.alpha = (atoi (value) / 100.0);
- else if (strcmp (key, "font_active_color") == 0)
- get_color (value, g_task.font_active.color);
- else if (strcmp (key, "font_active_alpha") == 0)
- g_task.font_active.alpha = (atoi (value) / 100.0);
- else if (strcmp (key, "panel_show_all_desktop") == 0) {
- if (atoi (value) == 0) panel.mode = SINGLE_DESKTOP;
- else panel.mode = MULTI_DESKTOP;
- }
- else if (strcmp (key, "panel_width") == 0)
- panel.area.width = atoi (value);
- else if (strcmp (key, "panel_height") == 0)
- panel.area.height = atoi (value);
- else if (strcmp (key, "panel_background") == 0)
- panel.old_panel_background = atoi (value);
- else if (strcmp (key, "panel_background_alpha") == 0)
- panel.area.back.alpha = (atoi (value) / 100.0);
- else if (strcmp (key, "panel_border_alpha") == 0)
- panel.area.border.alpha = (atoi (value) / 100.0);
- else if (strcmp (key, "task_icon") == 0)
- panel.old_task_icon = atoi (value);
- else if (strcmp (key, "task_background") == 0)
- panel.old_task_background = atoi (value);
- else if (strcmp (key, "task_background_alpha") == 0)
- g_task.area.back.alpha = (atoi (value) / 100.0);
- else if (strcmp (key, "task_active_background_alpha") == 0)
- g_task.area_active.back.alpha = (atoi (value) / 100.0);
- else if (strcmp (key, "task_border_alpha") == 0)
- g_task.area.border.alpha = (atoi (value) / 100.0);
- else if (strcmp (key, "task_active_border_alpha") == 0)
- g_task.area_active.border.alpha = (atoi (value) / 100.0);
- // disabled parameters
- else if (strcmp (key, "task_active_border_width") == 0) ;
- else if (strcmp (key, "task_active_rounded") == 0) ;
-
- else
- fprintf(stderr, "Invalid option: \"%s\", correct your config file\n", key);
-
- if (value1) free (value1);
- if (value2) free (value2);
+ char *value1=0, *value2=0, *value3=0;
+
+ /* Background and border */
+ if (strcmp (key, "rounded") == 0) {
+ // 'rounded' is the first parameter => alloc a new background
+ Area *a = calloc(1, sizeof(Area));
+ a->pix.border.rounded = atoi (value);
+ list_back = g_slist_append(list_back, a);
+ }
+ else if (strcmp (key, "border_width") == 0) {
+ Area *a = g_slist_last(list_back)->data;
+ a->pix.border.width = atoi (value);
+ }
+ else if (strcmp (key, "background_color") == 0) {
+ Area *a = g_slist_last(list_back)->data;
+ extract_values(value, &value1, &value2, &value3);
+ get_color (value1, a->pix.back.color);
+ if (value2) a->pix.back.alpha = (atoi (value2) / 100.0);
+ else a->pix.back.alpha = 0.5;
+ }
+ else if (strcmp (key, "border_color") == 0) {
+ Area *a = g_slist_last(list_back)->data;
+ extract_values(value, &value1, &value2, &value3);
+ get_color (value1, a->pix.border.color);
+ if (value2) a->pix.border.alpha = (atoi (value2) / 100.0);
+ else a->pix.border.alpha = 0.5;
+ }
+
+ /* Panel */
+ else if (strcmp (key, "panel_monitor") == 0) {
+ if (strcmp (value, "all") == 0) panel_config.monitor = -1;
+ else {
+ panel_config.monitor = atoi (value);
+ if (panel_config.monitor > 0) panel_config.monitor -= 1;
+ }
+ }
+ else if (strcmp (key, "panel_size") == 0) {
+ extract_values(value, &value1, &value2, &value3);
+
+ char *b;
+ if ((b = strchr (value1, '%'))) {
+ b[0] = '\0';
+ panel_config.pourcentx = 1;
+ }
+ panel_config.initial_width = atof(value1);
+ if (value2) {
+ if ((b = strchr (value2, '%'))) {
+ b[0] = '\0';
+ panel_config.pourcenty = 1;
+ }
+ panel_config.initial_height = atof(value2);
+ }
+ }
+ else if (strcmp (key, "panel_margin") == 0) {
+ extract_values(value, &value1, &value2, &value3);
+ panel_config.marginx = atoi (value1);
+ if (value2) panel_config.marginy = atoi (value2);
+ }
+ else if (strcmp (key, "panel_padding") == 0) {
+ extract_values(value, &value1, &value2, &value3);
+ panel_config.area.paddingxlr = panel_config.area.paddingx = atoi (value1);
+ if (value2) panel_config.area.paddingy = atoi (value2);
+ if (value3) panel_config.area.paddingx = atoi (value3);
+ }
+ else if (strcmp (key, "panel_position") == 0) {
+ extract_values(value, &value1, &value2, &value3);
+ if (strcmp (value1, "top") == 0) panel_position = TOP;
+ else {
+ if (strcmp (value1, "bottom") == 0) panel_position = BOTTOM;
+ else panel_position = CENTER;
+ }
+
+ if (!value2) panel_position |= CENTER;
+ else {
+ if (strcmp (value2, "left") == 0) panel_position |= LEFT;
+ else {
+ if (strcmp (value2, "right") == 0) panel_position |= RIGHT;
+ else panel_position |= CENTER;
+ }
+ }
+ if (!value3) panel_horizontal = 1;
+ else {
+ if (strcmp (value3, "vertical") == 0) panel_horizontal = 0;
+ else panel_horizontal = 1;
+ }
+ }
+ else if (strcmp (key, "font_shadow") == 0)
+ panel_config.g_task.font_shadow = atoi (value);
+ else if (strcmp (key, "panel_background_id") == 0) {
+ int id = atoi (value);
+ Area *a = g_slist_nth_data(list_back, id);
+ memcpy(&panel_config.area.pix.back, &a->pix.back, sizeof(Color));
+ memcpy(&panel_config.area.pix.border, &a->pix.border, sizeof(Border));
+ }
+ else if (strcmp (key, "wm_menu") == 0)
+ wm_menu = atoi (value);
+ else if (strcmp (key, "panel_dock") == 0)
+ panel_dock = atoi (value);
+ else if (strcmp (key, "urgent_nb_of_blink") == 0)
+ max_tick_urgent = (atoi (value) * 2) + 1;
+
+ /* Battery */
+ else if (strcmp (key, "battery") == 0) {
+#ifdef ENABLE_BATTERY
+ if(atoi(value) == 1)
+ panel_config.battery.area.on_screen = 1;
+#else
+ if(atoi(value) == 1)
+ fprintf(stderr, "tint2 is build without battery support\n");
+#endif
+ }
+ else if (strcmp (key, "battery_low_status") == 0) {
+#ifdef ENABLE_BATTERY
+ battery_low_status = atoi(value);
+ if(battery_low_status < 0 || battery_low_status > 100)
+ battery_low_status = 0;
+#endif
+ }
+ else if (strcmp (key, "battery_low_cmd") == 0) {
+#ifdef ENABLE_BATTERY
+ if (battery_low_cmd) g_free(battery_low_cmd);
+ if (strlen(value) > 0) battery_low_cmd = strdup (value);
+ else battery_low_cmd = 0;
+#endif
+ }
+ else if (strcmp (key, "bat1_font") == 0) {
+#ifdef ENABLE_BATTERY
+ if (save_file_config) old_bat1_font = strdup (value);
+ if (bat1_font_desc) pango_font_description_free(bat1_font_desc);
+ bat1_font_desc = pango_font_description_from_string (value);
+#endif
+ }
+ else if (strcmp (key, "bat2_font") == 0) {
+#ifdef ENABLE_BATTERY
+ if (save_file_config) old_bat2_font = strdup (value);
+ if (bat2_font_desc) pango_font_description_free(bat2_font_desc);
+ bat2_font_desc = pango_font_description_from_string (value);
+#endif
+ }
+ else if (strcmp (key, "battery_font_color") == 0) {
+#ifdef ENABLE_BATTERY
+ extract_values(value, &value1, &value2, &value3);
+ get_color (value1, panel_config.battery.font.color);
+ if (value2) panel_config.battery.font.alpha = (atoi (value2) / 100.0);
+ else panel_config.battery.font.alpha = 0.5;
+#endif
+ }
+ else if (strcmp (key, "battery_padding") == 0) {
+#ifdef ENABLE_BATTERY
+ extract_values(value, &value1, &value2, &value3);
+ panel_config.battery.area.paddingxlr = panel_config.battery.area.paddingx = atoi (value1);
+ if (value2) panel_config.battery.area.paddingy = atoi (value2);
+ if (value3) panel_config.battery.area.paddingx = atoi (value3);
+#endif
+ }
+ else if (strcmp (key, "battery_background_id") == 0) {
+#ifdef ENABLE_BATTERY
+ int id = atoi (value);
+ Area *a = g_slist_nth_data(list_back, id);
+ memcpy(&panel_config.battery.area.pix.back, &a->pix.back, sizeof(Color));
+ memcpy(&panel_config.battery.area.pix.border, &a->pix.border, sizeof(Border));
+#endif
+ }
+
+ /* Clock */
+ else if (strcmp (key, "time1_format") == 0) {
+ if (time1_format) g_free(time1_format);
+ if (strlen(value) > 0) {
+ time1_format = strdup (value);
+ panel_config.clock.area.on_screen = 1;
+ }
+ else {
+ time1_format = 0;
+ panel_config.clock.area.on_screen = 0;
+ }
+ }
+ else if (strcmp (key, "time2_format") == 0) {
+ if (time2_format) g_free(time2_format);
+ if (strlen(value) > 0) time2_format = strdup (value);
+ else time2_format = 0;
+ }
+ else if (strcmp (key, "time1_font") == 0) {
+ if (save_file_config) old_time1_font = strdup (value);
+ if (time1_font_desc) pango_font_description_free(time1_font_desc);
+ time1_font_desc = pango_font_description_from_string (value);
+ }
+ else if (strcmp (key, "time2_font") == 0) {
+ if (save_file_config) old_time2_font = strdup (value);
+ if (time2_font_desc) pango_font_description_free(time2_font_desc);
+ time2_font_desc = pango_font_description_from_string (value);
+ }
+ else if (strcmp (key, "clock_font_color") == 0) {
+ extract_values(value, &value1, &value2, &value3);
+ get_color (value1, panel_config.clock.font.color);
+ if (value2) panel_config.clock.font.alpha = (atoi (value2) / 100.0);
+ else panel_config.clock.font.alpha = 0.5;
+ }
+ else if (strcmp (key, "clock_padding") == 0) {
+ extract_values(value, &value1, &value2, &value3);
+ panel_config.clock.area.paddingxlr = panel_config.clock.area.paddingx = atoi (value1);
+ if (value2) panel_config.clock.area.paddingy = atoi (value2);
+ if (value3) panel_config.clock.area.paddingx = atoi (value3);
+ }
+ else if (strcmp (key, "clock_background_id") == 0) {
+ int id = atoi (value);
+ Area *a = g_slist_nth_data(list_back, id);
+ memcpy(&panel_config.clock.area.pix.back, &a->pix.back, sizeof(Color));
+ memcpy(&panel_config.clock.area.pix.border, &a->pix.border, sizeof(Border));
+ }
+ else if (strcmp(key, "clock_lclick_command") == 0) {
+ if (clock_lclick_command) g_free(clock_lclick_command);
+ if (strlen(value) > 0) clock_lclick_command = strdup(value);
+ else clock_lclick_command = 0;
+ }
+ else if (strcmp(key, "clock_rclick_command") == 0) {
+ if (clock_rclick_command) g_free(clock_rclick_command);
+ if (strlen(value) > 0) clock_rclick_command = strdup(value);
+ else clock_rclick_command = 0;
+ }
+
+ /* Taskbar */
+ else if (strcmp (key, "taskbar_mode") == 0) {
+ if (strcmp (value, "multi_desktop") == 0) panel_mode = MULTI_DESKTOP;
+ else panel_mode = SINGLE_DESKTOP;
+ }
+ else if (strcmp (key, "taskbar_padding") == 0) {
+ extract_values(value, &value1, &value2, &value3);
+ panel_config.g_taskbar.paddingxlr = panel_config.g_taskbar.paddingx = atoi (value1);
+ if (value2) panel_config.g_taskbar.paddingy = atoi (value2);
+ if (value3) panel_config.g_taskbar.paddingx = atoi (value3);
+ }
+ else if (strcmp (key, "taskbar_background_id") == 0) {
+ int id = atoi (value);
+ Area *a = g_slist_nth_data(list_back, id);
+ memcpy(&panel_config.g_taskbar.pix.back, &a->pix.back, sizeof(Color));
+ memcpy(&panel_config.g_taskbar.pix.border, &a->pix.border, sizeof(Border));
+ }
+ else if (strcmp (key, "taskbar_active_background_id") == 0) {
+ int id = atoi (value);
+ Area *a = g_slist_nth_data(list_back, id);
+ memcpy(&panel_config.g_taskbar.pix_active.back, &a->pix.back, sizeof(Color));
+ memcpy(&panel_config.g_taskbar.pix_active.border, &a->pix.border, sizeof(Border));
+ panel_config.g_taskbar.use_active = 1;
+ }
+
+ /* Task */
+ else if (strcmp (key, "task_text") == 0)
+ panel_config.g_task.text = atoi (value);
+ else if (strcmp (key, "task_icon") == 0)
+ panel_config.g_task.icon = atoi (value);
+ else if (strcmp (key, "task_centered") == 0)
+ panel_config.g_task.centered = atoi (value);
+ else if (strcmp (key, "task_width") == 0) {
+ // old parameter : just for backward compatibility
+ panel_config.g_task.maximum_width = atoi (value);
+ panel_config.g_task.maximum_height = 30;
+ }
+ else if (strcmp (key, "task_maximum_size") == 0) {
+ extract_values(value, &value1, &value2, &value3);
+ panel_config.g_task.maximum_width = atoi (value1);
+ panel_config.g_task.maximum_height = 30;
+ if (value2)
+ panel_config.g_task.maximum_height = atoi (value2);
+ }
+ else if (strcmp (key, "task_padding") == 0) {
+ extract_values(value, &value1, &value2, &value3);
+ panel_config.g_task.area.paddingxlr = panel_config.g_task.area.paddingx = atoi (value1);
+ if (value2) panel_config.g_task.area.paddingy = atoi (value2);
+ if (value3) panel_config.g_task.area.paddingx = atoi (value3);
+ }
+ else if (strcmp (key, "task_font") == 0) {
+ if (save_file_config) old_task_font = strdup (value);
+ if (panel_config.g_task.font_desc) pango_font_description_free(panel_config.g_task.font_desc);
+ panel_config.g_task.font_desc = pango_font_description_from_string (value);
+ }
+ else if (strcmp (key, "task_font_color") == 0) {
+ extract_values(value, &value1, &value2, &value3);
+ get_color (value1, panel_config.g_task.font.color);
+ if (value2) panel_config.g_task.font.alpha = (atoi (value2) / 100.0);
+ else panel_config.g_task.font.alpha = 0.1;
+ }
+ else if (strcmp (key, "task_active_font_color") == 0) {
+ extract_values(value, &value1, &value2, &value3);
+ get_color (value1, panel_config.g_task.font_active.color);
+ if (value2) panel_config.g_task.font_active.alpha = (atoi (value2) / 100.0);
+ else panel_config.g_task.font_active.alpha = 0.1;
+ }
+ else if (strcmp (key, "task_icon_asb") == 0) {
+ extract_values(value, &value1, &value2, &value3);
+ panel_config.g_task.alpha = atoi(value1);
+ panel_config.g_task.saturation = atoi(value2);
+ panel_config.g_task.brightness = atoi(value3);
+ }
+ else if (strcmp (key, "task_active_icon_asb") == 0) {
+ extract_values(value, &value1, &value2, &value3);
+ panel_config.g_task.alpha_active = atoi(value1);
+ panel_config.g_task.saturation_active = atoi(value2);
+ panel_config.g_task.brightness_active = atoi(value3);
+ }
+ else if (strcmp (key, "task_background_id") == 0) {
+ int id = atoi (value);
+ Area *a = g_slist_nth_data(list_back, id);
+ memcpy(&panel_config.g_task.area.pix.back, &a->pix.back, sizeof(Color));
+ memcpy(&panel_config.g_task.area.pix.border, &a->pix.border, sizeof(Border));
+ }
+ else if (strcmp (key, "task_active_background_id") == 0) {
+ int id = atoi (value);
+ Area *a = g_slist_nth_data(list_back, id);
+ memcpy(&panel_config.g_task.area.pix_active.back, &a->pix.back, sizeof(Color));
+ memcpy(&panel_config.g_task.area.pix_active.border, &a->pix.border, sizeof(Border));
+ }
+
+ /* Systray */
+ else if (strcmp (key, "systray_padding") == 0) {
+ extract_values(value, &value1, &value2, &value3);
+ systray.area.paddingxlr = systray.area.paddingx = atoi (value1);
+ if (value2) systray.area.paddingy = atoi (value2);
+ if (value3) systray.area.paddingx = atoi (value3);
+ systray.area.on_screen = 1;
+ }
+ else if (strcmp (key, "systray_background_id") == 0) {
+ int id = atoi (value);
+ Area *a = g_slist_nth_data(list_back, id);
+ memcpy(&systray.area.pix.back, &a->pix.back, sizeof(Color));
+ memcpy(&systray.area.pix.border, &a->pix.border, sizeof(Border));
+ }
+ else if (strcmp(key, "systray_sort") == 0) {
+ if (strcmp(value, "descending") == 0)
+ systray.sort = -1;
+ else if (strcmp(value, "ascending") == 0)
+ systray.sort = 1;
+ else if (strcmp(value, "left2right") == 0)
+ systray.sort = 2;
+ else if (strcmp(value, "right2left") == 0)
+ systray.sort = 3;
+ }
+
+ /* Tooltip */
+ else if (strcmp (key, "tooltip") == 0)
+ g_tooltip.enabled = atoi(value);
+ else if (strcmp (key, "tooltip_show_timeout") == 0) {
+ double timeout = atof(value);
+ int sec = (int)timeout;
+ int usec = (timeout-sec)*1e6;
+ g_tooltip.show_timeout.it_value = (struct timeval){.tv_sec=sec, .tv_usec=usec};
+ }
+ else if (strcmp (key, "tooltip_hide_timeout") == 0) {
+ double timeout = atof(value);
+ int sec = (int)timeout;
+ int usec = (timeout-sec)*1e6;
+ g_tooltip.hide_timeout.it_value = (struct timeval){.tv_sec=sec, .tv_usec=usec};
+ }
+ else if (strcmp (key, "tooltip_padding") == 0) {
+ extract_values(value, &value1, &value2, &value3);
+ if (value1) g_tooltip.paddingx = atoi(value1);
+ if (value2) g_tooltip.paddingy = atoi(value2);
+ }
+ else if (strcmp (key, "tooltip_background_id") == 0) {
+ int id = atoi (value);
+ Area *a = g_slist_nth_data(list_back, id);
+ memcpy(&g_tooltip.background_color, &a->pix.back, sizeof(Color));
+ memcpy(&g_tooltip.border, &a->pix.border, sizeof(Border));
+ }
+ else if (strcmp (key, "tooltip_font_color") == 0) {
+ extract_values(value, &value1, &value2, &value3);
+ get_color(value1, g_tooltip.font_color.color);
+ if (value2) g_tooltip.font_color.alpha = (atoi (value2) / 100.0);
+ else g_tooltip.font_color.alpha = 0.1;
+ }
+ else if (strcmp (key, "tooltip_font") == 0) {
+ if (g_tooltip.font_desc) pango_font_description_free(g_tooltip.font_desc);
+ g_tooltip.font_desc = pango_font_description_from_string(value);
+ }
+
+ /* Mouse actions */
+ else if (strcmp (key, "mouse_middle") == 0)
+ get_action (value, &mouse_middle);
+ else if (strcmp (key, "mouse_right") == 0)
+ get_action (value, &mouse_right);
+ else if (strcmp (key, "mouse_scroll_up") == 0)
+ get_action (value, &mouse_scroll_up);
+ else if (strcmp (key, "mouse_scroll_down") == 0)
+ get_action (value, &mouse_scroll_down);
+
+
+ /* Read tint-0.6 config for backward compatibility */
+ else if (strcmp (key, "panel_mode") == 0) {
+ save_file_config = 1;
+ if (strcmp (value, "single_desktop") == 0) panel_mode = SINGLE_DESKTOP;
+ else panel_mode = MULTI_DESKTOP;
+ }
+ else if (strcmp (key, "panel_rounded") == 0) {
+ Area *a = calloc(1, sizeof(Area));
+ a->pix.border.rounded = atoi (value);
+ list_back = g_slist_append(list_back, a);
+ }
+ else if (strcmp (key, "panel_border_width") == 0) {
+ Area *a = g_slist_last(list_back)->data;
+ a->pix.border.width = atoi (value);
+ }
+ else if (strcmp (key, "panel_background_color") == 0) {
+ Area *a = g_slist_last(list_back)->data;
+ extract_values(value, &value1, &value2, &value3);
+ get_color (value1, a->pix.back.color);
+ if (value2) a->pix.back.alpha = (atoi (value2) / 100.0);
+ else a->pix.back.alpha = 0.5;
+ }
+ else if (strcmp (key, "panel_border_color") == 0) {
+ Area *a = g_slist_last(list_back)->data;
+ extract_values(value, &value1, &value2, &value3);
+ get_color (value1, a->pix.border.color);
+ if (value2) a->pix.border.alpha = (atoi (value2) / 100.0);
+ else a->pix.border.alpha = 0.5;
+ }
+ else if (strcmp (key, "task_text_centered") == 0)
+ panel_config.g_task.centered = atoi (value);
+ else if (strcmp (key, "task_margin") == 0) {
+ panel_config.g_taskbar.paddingxlr = 0;
+ panel_config.g_taskbar.paddingx = atoi (value);
+ }
+ else if (strcmp (key, "task_icon_size") == 0)
+ old_task_icon_size = atoi (value);
+ else if (strcmp (key, "task_rounded") == 0) {
+ area_task = calloc(1, sizeof(Area));
+ area_task->pix.border.rounded = atoi (value);
+ list_back = g_slist_append(list_back, area_task);
+
+ area_task_active = calloc(1, sizeof(Area));
+ area_task_active->pix.border.rounded = atoi (value);
+ list_back = g_slist_append(list_back, area_task_active);
+ }
+ else if (strcmp (key, "task_background_color") == 0) {
+ extract_values(value, &value1, &value2, &value3);
+ get_color (value1, area_task->pix.back.color);
+ if (value2) area_task->pix.back.alpha = (atoi (value2) / 100.0);
+ else area_task->pix.back.alpha = 0.5;
+ }
+ else if (strcmp (key, "task_active_background_color") == 0) {
+ extract_values(value, &value1, &value2, &value3);
+ get_color (value1, area_task_active->pix.back.color);
+ if (value2) area_task_active->pix.back.alpha = (atoi (value2) / 100.0);
+ else area_task_active->pix.back.alpha = 0.5;
+ }
+ else if (strcmp (key, "task_border_width") == 0) {
+ area_task->pix.border.width = atoi (value);
+ area_task_active->pix.border.width = atoi (value);
+ }
+ else if (strcmp (key, "task_border_color") == 0) {
+ extract_values(value, &value1, &value2, &value3);
+ get_color (value1, area_task->pix.border.color);
+ if (value2) area_task->pix.border.alpha = (atoi (value2) / 100.0);
+ else area_task->pix.border.alpha = 0.5;
+ }
+ else if (strcmp (key, "task_active_border_color") == 0) {
+ extract_values(value, &value1, &value2, &value3);
+ get_color (value1, area_task_active->pix.border.color);
+ if (value2) area_task_active->pix.border.alpha = (atoi (value2) / 100.0);
+ else area_task_active->pix.border.alpha = 0.5;
+ }
+
+ else
+ fprintf(stderr, "tint2 : invalid option \"%s\", correct your config file\n", key);
+
+ if (value1) free (value1);
+ if (value2) free (value2);
+ if (value3) free (value3);