The code to replace $wid/$pid died on $foo.
[dana/openbox.git] / openbox / actions / execute.c
index 05ab2ef..376eee5 100644 (file)
@@ -144,7 +144,7 @@ static gboolean run_func(ObActionsData *data, gpointer options)
     if (data->client) {
         gchar *c, *before, *expand;
 
-        /* replace occurances of $pid and $window */
+        /* replace occurrences of $pid and $wid */
 
         expand = NULL;
         before = cmd;
@@ -168,13 +168,12 @@ static gboolean run_func(ObActionsData *data, gpointer options)
 
                 before = c + 4; /* 4 = strlen("$pid") */
             }
-
-            if ((c[1] == 'w' || c[1] == 'W') &&
+            else if ((c[1] == 'w' || c[1] == 'W') &&
                 (c[2] == 'i' || c[2] == 'I') &&
                 (c[3] == 'd' || c[3] == 'D') &&
-                !g_ascii_isalnum(c[7]))
+                !g_ascii_isalnum(c[4]))
             {
-                /* found $window */
+                /* found $wid */
                 gchar *tmp;
 
                 *c = '\0';
@@ -185,8 +184,10 @@ static gboolean run_func(ObActionsData *data, gpointer options)
                                          data->client->window);
                 g_free(tmp);
 
-                before = c + 7; /* 4 = strlen("$window") */
+                before = c + 4; /* 4 = strlen("$wid") */
             }
+            else
+                before = c + 1; /* no infinite loops plz */
         }
 
         if (expand) {