]> Dogcows Code - chaz/tint2/blobdiff - src/config.c
*fix* broken icons on amd64. fixes issue 155
[chaz/tint2] / src / config.c
index 9396dcb3ce2f4205f05f4a7f9295304c9ef02c3a..bb50b874fe98422f6044dbf63bee7e1712e6069f 100644 (file)
@@ -43,6 +43,7 @@
 #include "panel.h"
 #include "config.h"
 #include "window.h"
+#include "tooltip.h"
 
 #ifdef ENABLE_BATTERY
 #include "battery.h"
@@ -78,16 +79,19 @@ void init_config()
        cleanup_panel();
 
        // get monitor and desktop config
-       get_monitors_and_desktops();
+       get_monitors();
+       get_desktops();
 
        // append full transparency background
        list_back = g_slist_append(0, calloc(1, sizeof(Area)));
 
        panel_config = calloc(1, sizeof(Panel));
-       systray.sort = 1;
+       panel_config->g_task.alpha = 100;
+       panel_config->g_task.alpha_active = 100;
+       systray.sort = 3;
 
        // window manager's menu default value == false
-       wm_menu = 0;
+       wm_menu = wm_menu_open = 0;
        max_tick_urgent = 7;
 }
 
@@ -529,15 +533,15 @@ void add_entry (char *key, char *value)
                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_hsb") == 0) {
+       else if (strcmp (key, "task_icon_asb") == 0) {
                extract_values(value, &value1, &value2, &value3);
-               panel_config->g_task.hue = atoi(value1);
+               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_hsb") == 0) {
+       else if (strcmp (key, "task_active_icon_asb") == 0) {
                extract_values(value, &value1, &value2, &value3);
-               panel_config->g_task.hue_active = atoi(value1);
+               panel_config->g_task.alpha_active = atoi(value1);
                panel_config->g_task.saturation_active = atoi(value2);
                panel_config->g_task.brightness_active = atoi(value3);
        }
@@ -569,10 +573,51 @@ void add_entry (char *key, char *value)
                memcpy(&systray.area.pix.border, &a->pix.border, sizeof(Border));
        }
        else if (strcmp(key, "systray_sort") == 0) {
-               if (strcmp(value, "desc") == 0)
+               if (strcmp(value, "descending") == 0)
                        systray.sort = -1;
-               else
+               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 */
@@ -702,7 +747,7 @@ int parse_line (const char *line)
 void config_finish ()
 {
        if (panel_config->monitor > (server.nb_monitor-1)) {
-               // server.nb_monitor minimum value is 1 (see get_monitors_and_desktops())
+               // server.nb_monitor minimum value is 1 (see get_monitors())
                // and panel_config->monitor is higher
                fprintf(stderr, "warning : monitor not found. tint2 default to monitor 1.\n");
                panel_config->monitor = 0;
@@ -737,6 +782,7 @@ void config_finish ()
 #endif
        init_systray();
        init_taskbar();
+       init_tooltip();
        visible_object();
 
        cleanup_config();
This page took 0.024495 seconds and 4 git commands to generate.