X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fcommands.c;h=3cf5a57c480192806b2bb8c53b159941a210429f;hb=7fc3bf660e58ad11908be60d7df048f920e74689;hp=b7fbce902f324836cab989ab2cfca3bd96e7fc5a;hpb=351d891f4cfdc97189898025ce4eed3eec31afab;p=i3%2Fi3 diff --git a/src/commands.c b/src/commands.c index b7fbce90..3cf5a57c 100644 --- a/src/commands.c +++ b/src/commands.c @@ -1626,24 +1626,18 @@ void cmd_open(I3_CMD) { * */ void cmd_focus_output(I3_CMD, const char *name) { - owindow *current; - - DLOG("name = %s\n", name); - HANDLE_EMPTY_MATCH; - /* get the output */ - Output *current_output = NULL; - Output *output; - - TAILQ_FOREACH(current, &owindows, owindows) - current_output = get_output_for_con(current->con); - assert(current_output != NULL); + if (TAILQ_EMPTY(&owindows)) { + ysuccess(true); + return; + } - output = get_output_from_string(current_output, name); + Output *current_output = get_output_for_con(TAILQ_FIRST(&owindows)->con); + Output *output = get_output_from_string(current_output, name); if (!output) { - yerror("No such output found."); + yerror("Output %s not found.", name); return; } @@ -1658,7 +1652,6 @@ void cmd_focus_output(I3_CMD, const char *name) { workspace_show(ws); cmd_output->needs_tree_render = true; - // XXX: default reply for now, make this a better reply ysuccess(true); }