]> Dogcows Code - chaz/tint2/blobdiff - src/config.c
fixed resize_clock() and snapshot
[chaz/tint2] / src / config.c
index c159a30e043da926cfdd4654570ad315401d8c92..9e74f1751d94bb9d9f0642c0a5089b517e6a2c99 100644 (file)
@@ -87,9 +87,6 @@ void init_config()
                pango_font_description_free(panel_config.g_task.font_desc);
        }
        memset(&panel_config, 0, sizeof(Panel));
-       int i;
-       for (i=0; i<TASK_STATE_COUNT; ++i)
-               panel_config.g_task.alpha[i] = 100;
        systray.alpha = 100;
        systray.sort = 3;
        old_config_file = 1;
@@ -188,6 +185,30 @@ int get_task_status(char* status)
 }
 
 
+int config_get_monitor(char* monitor)
+{
+       if (strcmp(monitor, "all") == 0)
+               return -1;
+       else {
+               char* endptr;
+               int ret_int = strtol(monitor, &endptr, 10);
+               if (*endptr == 0)
+                       return ret_int-1;
+               else {
+                       // monitor specified by name, not by index
+                       int i, j;
+                       for (i=0; i<server.nb_monitor; ++i) {
+                               j = 0;
+                               while (server.monitor[i].names[j] != 0) {
+                                       if (strcmp(monitor, server.monitor[i].names[j++]) == 0)
+                                               return i;
+                               }
+                       }
+               }
+       }
+       return -1;
+}
+
 void add_entry (char *key, char *value)
 {
        char *value1=0, *value2=0, *value3=0;
@@ -219,11 +240,7 @@ void add_entry (char *key, char *value)
 
        /* 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;
-               }
+               panel_config.monitor = config_get_monitor(value);
        }
        else if (strcmp (key, "panel_size") == 0) {
                extract_values(value, &value1, &value2, &value3);
@@ -510,12 +527,13 @@ void add_entry (char *key, char *value)
        }
 
        /* Systray */
-       else if (strcmp (key, "systray") == 0) {
+       // systray disabled in snapshot mode
+       else if (strcmp (key, "systray") == 0 && snapshot_path == 0) {
                systray_enabled = atoi(value);
                // systray is latest option added. files without 'systray' are old.
                old_config_file = 0;
        }
-       else if (strcmp (key, "systray_padding") == 0) {
+       else if (strcmp (key, "systray_padding") == 0 && snapshot_path == 0) {
                if (old_config_file)
                        systray_enabled = 1;
                extract_values(value, &value1, &value2, &value3);
@@ -599,6 +617,8 @@ void add_entry (char *key, char *value)
        else if (strcmp(key, "strut_policy") == 0) {
                if (strcmp(value, "follow_size") == 0)
                        panel_strut_policy = STRUT_FOLLOW_SIZE;
+               else if (strcmp(value, "none") == 0)
+                       panel_strut_policy = STRUT_NONE;
                else
                        panel_strut_policy = STRUT_MINIMUM;
        }
This page took 0.024363 seconds and 4 git commands to generate.