From dcba8024deed7169598e936f8e1204077e7512ec Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Wed, 3 Aug 2011 03:33:12 +0200 Subject: [PATCH] also handle quoted workspace names, extend t/72 for that --- src/randr.c | 7 ++++++- testcases/t/72-start-on-named-ws.t | 23 ++++++++++++++++++++--- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/randr.c b/src/randr.c index e9ba0f07..441a0b43 100644 --- a/src/randr.c +++ b/src/randr.c @@ -378,8 +378,13 @@ void init_ws_for_output(Output *output, Con *content) { strncasecmp(bind->command, "workspace", strlen("workspace")) != 0) continue; DLOG("relevant command = %s\n", bind->command); + char *target = bind->command + strlen("workspace "); + if (*target == '"') + target++; FREE(ws->name); - ws->name = strdup(bind->command + strlen("workspace ")); + ws->name = strdup(target); + if (ws->name[strlen(ws->name)-1] == '"') + ws->name[strlen(ws->name)-1] = '\0'; DLOG("trying name *%s*\n", ws->name); TAILQ_FOREACH(out, &(croot->nodes_head), nodes) diff --git a/testcases/t/72-start-on-named-ws.t b/testcases/t/72-start-on-named-ws.t index 3ba8bb68..12661867 100644 --- a/testcases/t/72-start-on-named-ws.t +++ b/testcases/t/72-start-on-named-ws.t @@ -30,15 +30,32 @@ exit_gracefully($process->pid); # 2: with named workspaces, i3 should start on the first named one ############################################################## - -my $config = <pid); + +############################################################## +# 3: the same test as 2, but with a quoted workspace name +############################################################## + +$config = <