- 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) {
- panel.monitor = atoi (value);
- if (panel.monitor > 0) panel.monitor -= 1;
- }
- else if (strcmp (key, "panel_size") == 0) {
- extract_values(value, &value1, &value2, &value3);
- panel.area.width = atoi (value1);
- if (value2) panel.area.height = atoi (value2);
- }
- else if (strcmp (key, "panel_margin") == 0) {
- extract_values(value, &value1, &value2, &value3);
- panel.marginleft = panel.marginright = atoi (value1);
- if (value2) panel.marginy = atoi (value2);
- if (value3) panel.marginright = atoi (value3);
- }
- else if (strcmp (key, "panel_padding") == 0) {
- extract_values(value, &value1, &value2, &value3);
- panel.area.paddingxlr = panel.area.paddingx = atoi (value1);
- if (value2) panel.area.paddingy = atoi (value2);
- if (value3) panel.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 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 *a = g_slist_nth_data(list_back, id);
- memcpy(&panel.area.pix.back, &a->pix.back, sizeof(Color));
- memcpy(&panel.area.pix.border, &a->pix.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, &value3);
- 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, &value3);
- panel.clock.area.paddingxlr = panel.clock.area.paddingx = atoi (value1);
- if (value2) panel.clock.area.paddingy = atoi (value2);
- if (value3) panel.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.clock.area.pix.back, &a->pix.back, sizeof(Color));
- memcpy(&panel.clock.area.pix.border, &a->pix.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, &value3);
- g_taskbar.paddingxlr = g_taskbar.paddingx = atoi (value1);
- if (value2) g_taskbar.paddingy = atoi (value2);
- if (value3) 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(&g_taskbar.pix.back, &a->pix.back, sizeof(Color));
- memcpy(&g_taskbar.pix.border, &a->pix.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, &value3);
- g_task.area.paddingxlr = g_task.area.paddingx = atoi (value1);
- if (value2) g_task.area.paddingy = atoi (value2);
- if (value3) g_task.area.paddingx = atoi (value3);
- }
- 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, &value3);
- 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, &value3);
- 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 *a = g_slist_nth_data(list_back, id);
- memcpy(&g_task.area.pix.back, &a->pix.back, sizeof(Color));
- memcpy(&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(&g_task.area.pix_active.back, &a->pix.back, sizeof(Color));
- memcpy(&g_task.area.pix_active.border, &a->pix.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.pix.back.alpha = (atoi (value) / 100.0);
- else if (strcmp (key, "panel_border_alpha") == 0)
- panel.area.pix.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.pix.back.alpha = (atoi (value) / 100.0);
- else if (strcmp (key, "task_active_background_alpha") == 0)
- g_task.area.pix_active.back.alpha = (atoi (value) / 100.0);
- else if (strcmp (key, "task_border_alpha") == 0)
- g_task.area.pix.border.alpha = (atoi (value) / 100.0);
- else if (strcmp (key, "task_active_border_alpha") == 0)
- g_task.area.pix_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);
- if (value3) free (value3);
-}