]> git.lizzy.rs Git - bspwm.git/commitdiff
DESKTOP_SEL: discard hashes within `MONITOR_SEL:`
authorBastien Dejean <nihilhill@gmail.com>
Mon, 22 Mar 2021 11:06:47 +0000 (12:06 +0100)
committerBastien Dejean <nihilhill@gmail.com>
Mon, 22 Mar 2021 11:06:47 +0000 (12:06 +0100)
Fixes #1267.

src/query.c

index d5797151e5128b1820d12df7a4b7d30b06e4a332..b11662adad394d06486ead9a4f6ba0133dec81ab 100644 (file)
@@ -698,6 +698,12 @@ int desktop_from_desc(char *desc, coordinates_t *ref, coordinates_t *dst)
        desc = desc_copy;
 
        char *hash = strrchr(desc, '#');
+       char *colon = strrchr(desc, ':');
+
+       /* Discard hashes inside a MONITOR_SEL, e.g. `primary#next:focused` */
+       if (hash != NULL && colon != NULL && hash < colon) {
+               hash = NULL;
+       }
 
        if (hash != NULL) {
                *hash = '\0';
@@ -712,7 +718,6 @@ int desktop_from_desc(char *desc, coordinates_t *ref, coordinates_t *dst)
        }
 
        desktop_select_t sel = make_desktop_select();
-       char *colon = strrchr(desc, ':');
 
        if (!parse_desktop_modifiers(colon != NULL ? colon : desc, &sel)) {
                free(desc_copy);