]> Dogcows Code - chaz/openbox/commitdiff
if this works i will be a bit amazed, add class matching, and allow to match either...
authorMikael Magnusson <mikachu@comhem.se>
Fri, 9 Jun 2006 14:52:06 +0000 (14:52 +0000)
committerMikael Magnusson <mikachu@comhem.se>
Fri, 9 Jun 2006 14:52:06 +0000 (14:52 +0000)
openbox/client.c
openbox/config.c

index 4d0ad53432b097b23edf21a6297165eb9dab262e..ccd30787ed6a7c6b50b0112e9f9b3f8f4186d299 100644 (file)
@@ -213,7 +213,12 @@ static ObAppSettings *get_settings(ObClient *client)
     while (a) {
         ObAppSettings *app = (ObAppSettings *) a->data;
         
-        if (!strcmp(app->name, client->name)) {
+        if (
+            (app->name && && !app->class && !strcmp(app->name, client->name))
+            || (app->class && !app->name && !strcmp(app->class, client->class))
+            || (app->class && app->name && !strcmp(app->class, client->class)
+                && !strcmp(app->name, client->name))
+            ) {
             ob_debug("Window matching: %s\n", app->name);
             /* Match if no role was specified in the per app setting, or if the string
              * matches the beginning of the role, since apps like to set the role to
index a456a688004026fdc4ba05390bdca8f5aea4cec4..574d13ee7ff8fb730a857935c24b35b41b856453 100644 (file)
@@ -115,14 +115,28 @@ static void parse_per_app_settings(ObParseInst *i, xmlDocPtr doc,
                                    xmlNodePtr node, gpointer d)
 {
     xmlNodePtr app = parse_find_node("application", node->children);
-    gchar *name;
+    gchar *name, *class;
+    gboolean name_set, class_set;
+    gboolean x_pos_given;
 
     while (app) {
-        gboolean x_pos_given = FALSE;
-        if (parse_attr_string("name", app, &name)) {
+        name_set = class_set = x_pos_given = FALSE;
+
+        class_set = parse_attr_string("class", app, &class);
+        name_set = parse_attr_string("name", app, &name);
+        if (class_set || name_set) {
             xmlNodePtr n, c;
             ObAppSettings *settings = g_new0(ObAppSettings, 1);
-            settings->name = name;
+            
+            if (name_set)
+                settings->name = name;
+            else
+                settings->name = NULL;
+            if (class_set)
+                settings->class = class;
+            else
+                settings->class = NULL;
+
             if (!parse_attr_string("role", app, &settings->role))
                 settings->role = NULL;
 
@@ -810,6 +824,7 @@ void config_shutdown()
         ObAppSettings *itd = (ObAppSettings *)it->data;
         g_free(itd->name);
         g_free(itd->role);
+        g_free(itd->class);
         g_free(it->data);
     }
     g_slist_free(config_per_app_settings);
This page took 0.027148 seconds and 4 git commands to generate.