Skip to content

Commit

Permalink
DESKTOP_SEL: discard hashes within MONITOR_SEL:
Browse files Browse the repository at this point in the history
  • Loading branch information
baskerville committed Mar 22, 2021
1 parent 7012d99 commit fb35765
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/query.c
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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);
Expand Down

0 comments on commit fb35765

Please sign in to comment.