20 #define HANDLE_EMPTY_MATCH do { \
21 if (match_is_empty(current_match)) { \
22 owindow *ow = smalloc(sizeof(owindow)); \
24 TAILQ_INIT(&owindows); \
25 TAILQ_INSERT_TAIL(&owindows, ow, owindows); \
36 return (a - b) > ( (fabs(a) < fabs(b) ? fabs(b) : fabs(a)) * epsilon);
47 if (strcasecmp(output_str,
"left") == 0) {
51 }
else if (strcasecmp(output_str,
"right") == 0) {
55 }
else if (strcasecmp(output_str,
"up") == 0) {
59 }
else if (strcasecmp(output_str,
"down") == 0) {
71 static pid_t migration_pid = -1;
78 static void nagbar_exited(EV_P_ ev_child *watcher,
int revents) {
79 ev_child_stop(EV_A_ watcher);
80 if (!WIFEXITED(watcher->rstatus)) {
81 fprintf(stderr,
"ERROR: i3-nagbar did not exit normally.\n");
85 int exitcode = WEXITSTATUS(watcher->rstatus);
86 printf(
"i3-nagbar process exited with status %d\n", exitcode);
88 fprintf(stderr,
"ERROR: i3-nagbar could not be found. Is it correctly installed on your system?\n");
97 #if EV_VERSION_MAJOR >= 4
103 static void nagbar_cleanup(EV_P_ ev_cleanup *watcher,
int revent) {
104 if (migration_pid != -1) {
105 LOG(
"Sending SIGKILL (9) to i3-nagbar with PID %d\n", migration_pid);
106 kill(migration_pid, SIGKILL);
111 void cmd_MIGRATION_start_nagbar(
void) {
112 if (migration_pid != -1) {
113 fprintf(stderr,
"i3-nagbar already running.\n");
116 fprintf(stderr,
"Starting i3-nagbar, command parsing differs from expected output.\n");
117 ELOG(
"Please report this on IRC or in the bugtracker. Make sure to include the full debug level logfile:\n");
118 ELOG(
"i3-dump-log | gzip -9c > /tmp/i3.log.gz\n");
119 ELOG(
"FYI: Your i3 version is " I3_VERSION
"\n");
120 migration_pid = fork();
121 if (migration_pid == -1) {
122 warn(
"Could not fork()");
127 if (migration_pid == 0) {
135 "You found a parsing error. Please, please, please, report it!",
146 ev_child *child =
smalloc(
sizeof(ev_child));
153 #if EV_VERSION_MAJOR >= 4
156 ev_cleanup *cleanup =
smalloc(
sizeof(ev_cleanup));
157 ev_cleanup_init(cleanup, nagbar_cleanup);
201 DLOG(
"match specification finished, matching...\n");
204 struct owindows_head old =
owindows;
213 DLOG(
"checking if con %p / %s matches\n", current->
con, current->
con->
name);
216 DLOG(
"matches container!\n");
221 DLOG(
"match by mark\n");
227 DLOG(
"matches window!\n");
230 DLOG(
"doesnt match\n");
247 DLOG(
"ctype=*%s*, cvalue=*%s*\n", ctype, cvalue);
249 if (strcmp(ctype,
"class") == 0) {
254 if (strcmp(ctype,
"instance") == 0) {
259 if (strcmp(ctype,
"window_role") == 0) {
264 if (strcmp(ctype,
"con_id") == 0) {
266 long parsed = strtol(cvalue, &end, 10);
267 if (parsed == LONG_MIN ||
268 parsed == LONG_MAX ||
270 (end && *end !=
'\0')) {
271 ELOG(
"Could not parse con id \"%s\"\n", cvalue);
279 if (strcmp(ctype,
"id") == 0) {
281 long parsed = strtol(cvalue, &end, 10);
282 if (parsed == LONG_MIN ||
283 parsed == LONG_MAX ||
285 (end && *end !=
'\0')) {
286 ELOG(
"Could not parse window id \"%s\"\n", cvalue);
294 if (strcmp(ctype,
"con_mark") == 0) {
299 if (strcmp(ctype,
"title") == 0) {
304 if (strcmp(ctype,
"urgent") == 0) {
305 if (strcasecmp(cvalue,
"latest") == 0 ||
306 strcasecmp(cvalue,
"newest") == 0 ||
307 strcasecmp(cvalue,
"recent") == 0 ||
308 strcasecmp(cvalue,
"last") == 0) {
310 }
else if (strcasecmp(cvalue,
"oldest") == 0 ||
311 strcasecmp(cvalue,
"first") == 0) {
317 ELOG(
"Unknown criterion: %s\n", ctype);
328 DLOG(
"which=%s\n", which);
334 if (strcmp(which,
"next") == 0)
336 else if (strcmp(which,
"prev") == 0)
338 else if (strcmp(which,
"next_on_output") == 0)
340 else if (strcmp(which,
"prev_on_output") == 0)
343 ELOG(
"BUG: called with which=%s\n", which);
344 cmd_output->json_output =
sstrdup(
"{\"sucess\": false}");
353 cmd_output->needs_tree_render =
true;
355 cmd_output->json_output =
sstrdup(
"{\"success\": true}");
363 if (strncasecmp(name,
"__i3_", strlen(
"__i3_")) == 0) {
364 LOG(
"You cannot switch to the i3 internal workspaces.\n");
365 cmd_output->json_output =
sstrdup(
"{\"sucess\": false}");
374 cmd_output->json_output =
sstrdup(
"{\"sucess\": false}");
378 LOG(
"should move window to workspace %s\n", name);
389 cmd_output->needs_tree_render =
true;
391 cmd_output->json_output =
sstrdup(
"{\"success\": true}");
404 cmd_output->json_output =
sstrdup(
"{\"sucess\": false}");
408 LOG(
"should move window to workspace with number %d\n", which);
410 Con *output, *workspace = NULL;
413 long parsed_num = strtol(which, &endptr, 10);
414 if (parsed_num == LONG_MIN ||
415 parsed_num == LONG_MAX ||
418 LOG(
"Could not parse \"%s\" as a number.\n", which);
419 cmd_output->json_output =
sstrdup(
"{\"success\": false, "
420 "\"error\": \"Could not parse number\"}");
426 child->
num == parsed_num);
429 cmd_output->json_output =
sstrdup(
"{\"success\": false, "
430 "\"error\": \"No such workspace\"}");
441 cmd_output->needs_tree_render =
true;
443 cmd_output->json_output =
sstrdup(
"{\"success\": true}");
447 LOG(
"floating resize\n");
448 if (strcmp(direction,
"up") == 0) {
449 floating_con->
rect.
y -= px;
451 }
else if (strcmp(direction,
"down") == 0) {
453 }
else if (strcmp(direction,
"left") == 0) {
454 floating_con->
rect.
x -= px;
462 LOG(
"tiling resize\n");
467 current = current->
parent;
471 (strcmp(direction,
"left") == 0 || strcmp(direction,
"right") == 0 ?
HORIZ :
VERT);
473 while (current->
type != CT_WORKSPACE &&
474 current->
type != CT_FLOATING_CON &&
476 current = current->
parent;
481 LOG(
"ins. %d children\n", children);
482 double percentage = 1.0 / children;
483 LOG(
"default percentage = %f\n", percentage);
487 if ((orientation ==
HORIZ &&
488 (strcmp(direction,
"up") == 0 || strcmp(direction,
"down") == 0)) ||
489 (orientation ==
VERT &&
490 (strcmp(direction,
"left") == 0 || strcmp(direction,
"right") == 0))) {
491 LOG(
"You cannot resize in that direction. Your focus is in a %s split container currently.\n",
492 (orientation ==
HORIZ ?
"horizontal" :
"vertical"));
493 cmd_output->json_output =
sstrdup(
"{\"sucess\": false}");
497 if (strcmp(direction,
"up") == 0 || strcmp(direction,
"left") == 0) {
498 other =
TAILQ_PREV(current, nodes_head, nodes);
503 LOG(
"No other container in this direction found, cannot resize.\n");
504 cmd_output->json_output =
sstrdup(
"{\"sucess\": false}");
508 LOG(
"current->percent before = %f\n", current->
percent);
513 double new_current_percent = current->
percent + ((double)ppt / 100.0);
514 double new_other_percent = other->
percent - ((double)ppt / 100.0);
515 LOG(
"new_current_percent = %f\n", new_current_percent);
516 LOG(
"new_other_percent = %f\n", new_other_percent);
521 current->
percent += ((double)ppt / 100.0);
522 other->
percent -= ((double)ppt / 100.0);
523 LOG(
"current->percent after = %f\n", current->
percent);
524 LOG(
"other->percent after = %f\n", other->
percent);
526 LOG(
"Not resizing, already at minimum size\n");
531 LOG(
"width/height resize\n");
536 current = current->
parent;
540 (strcmp(direction,
"width") == 0 ?
HORIZ :
VERT);
542 while (current->
type != CT_WORKSPACE &&
543 current->
type != CT_FLOATING_CON &&
545 current = current->
parent;
549 LOG(
"ins. %d children\n", children);
550 double percentage = 1.0 / children;
551 LOG(
"default percentage = %f\n", percentage);
555 if ((orientation ==
HORIZ &&
556 strcmp(direction,
"height") == 0) ||
557 (orientation ==
VERT &&
558 strcmp(direction,
"width") == 0)) {
559 LOG(
"You cannot resize in that direction. Your focus is in a %s split container currently.\n",
560 (orientation ==
HORIZ ?
"horizontal" :
"vertical"));
561 cmd_output->json_output =
sstrdup(
"{\"sucess\": false}");
566 LOG(
"This is the only container, cannot resize.\n");
567 cmd_output->json_output =
sstrdup(
"{\"sucess\": false}");
574 LOG(
"child->percent = %f (child %p)\n", child->
percent, child);
579 double new_current_percent = current->
percent + ((double)ppt / 100.0);
580 double subtract_percent = ((double)ppt / 100.0) / (children - 1);
581 LOG(
"new_current_percent = %f\n", new_current_percent);
582 LOG(
"subtract_percent = %f\n", subtract_percent);
586 if (child == current)
589 LOG(
"Not resizing, already at minimum size (child %p would end up with a size of %.f\n", child, child->
percent - subtract_percent);
590 cmd_output->json_output =
sstrdup(
"{\"sucess\": false}");
595 LOG(
"Not resizing, already at minimum size\n");
596 cmd_output->json_output =
sstrdup(
"{\"sucess\": false}");
600 current->
percent += ((double)ppt / 100.0);
601 LOG(
"current->percent after = %f\n", current->
percent);
604 if (child == current)
606 child->
percent -= subtract_percent;
607 LOG(
"child->percent after (%p) = %f\n", child, child->
percent);
617 DLOG(
"resizing in way %s, direction %s, px %s or ppt %s\n", way, direction, resize_px, resize_ppt);
619 int px = atoi(resize_px);
620 int ppt = atoi(resize_ppt);
621 if (strcmp(way,
"shrink") == 0) {
630 if (strcmp(direction,
"width") == 0 ||
631 strcmp(direction,
"height") == 0)
636 cmd_output->needs_tree_render =
true;
638 cmd_output->json_output =
sstrdup(
"{\"success\": true}");
646 DLOG(
"border style should be changed to %s\n", border_style_str);
654 if (strcmp(border_style_str,
"toggle") == 0) {
658 if (strcmp(border_style_str,
"normal") == 0)
660 else if (strcmp(border_style_str,
"none") == 0)
662 else if (strcmp(border_style_str,
"1pixel") == 0)
665 ELOG(
"BUG: called with border_style=%s\n", border_style_str);
666 cmd_output->json_output =
sstrdup(
"{\"sucess\": false}");
673 cmd_output->needs_tree_render =
true;
675 cmd_output->json_output =
sstrdup(
"{\"success\": true}");
683 LOG(
"-------------------------------------------------\n");
684 LOG(
" NOP: %s\n", comment);
685 LOG(
"-------------------------------------------------\n");
693 LOG(
"Appending layout \"%s\"\n", path);
696 cmd_output->needs_tree_render =
true;
698 cmd_output->json_output =
sstrdup(
"{\"success\": true}");
708 DLOG(
"which=%s\n", which);
710 if (strcmp(which,
"next") == 0)
712 else if (strcmp(which,
"prev") == 0)
714 else if (strcmp(which,
"next_on_output") == 0)
716 else if (strcmp(which,
"prev_on_output") == 0)
719 ELOG(
"BUG: called with which=%s\n", which);
720 cmd_output->json_output =
sstrdup(
"{\"sucess\": false}");
726 cmd_output->needs_tree_render =
true;
728 cmd_output->json_output =
sstrdup(
"{\"success\": true}");
736 Con *output, *workspace = NULL;
739 long parsed_num = strtol(which, &endptr, 10);
740 if (parsed_num == LONG_MIN ||
741 parsed_num == LONG_MAX ||
744 LOG(
"Could not parse \"%s\" as a number.\n", which);
745 cmd_output->json_output =
sstrdup(
"{\"success\": false, "
746 "\"error\": \"Could not parse number\"}");
752 child->
num == parsed_num);
755 LOG(
"There is no workspace with number %d.\n", parsed_num);
756 cmd_output->json_output =
sstrdup(
"{\"success\": false, "
757 "\"error\": \"No such workspace\"}");
763 cmd_output->needs_tree_render =
true;
765 cmd_output->json_output =
sstrdup(
"{\"success\": true}");
775 cmd_output->needs_tree_render =
true;
777 cmd_output->json_output =
sstrdup(
"{\"success\": true}");
785 if (strncasecmp(name,
"__i3_", strlen(
"__i3_")) == 0) {
786 LOG(
"You cannot switch to the i3 internal workspaces.\n");
787 cmd_output->json_output =
sstrdup(
"{\"sucess\": false}");
791 DLOG(
"should switch to workspace %s\n", name);
796 if (strcmp(ws->
name, name) == 0) {
797 DLOG(
"This workspace is already focused.\n");
802 cmd_output->json_output =
sstrdup(
"{\"sucess\": false}");
808 cmd_output->needs_tree_render =
true;
810 cmd_output->json_output =
sstrdup(
"{\"success\": true}");
818 DLOG(
"Clearing all windows which have that mark first\n");
822 if (con->
mark && strcmp(con->
mark, mark) == 0)
826 DLOG(
"marking window with str %s\n", mark);
836 cmd_output->needs_tree_render =
true;
838 cmd_output->json_output =
sstrdup(
"{\"success\": true}");
846 DLOG(
"mode=%s\n", mode);
850 cmd_output->json_output =
sstrdup(
"{\"success\": true}");
860 DLOG(
"should move window to output %s\n", name);
865 Output *current_output = NULL;
872 assert(current_output != NULL);
875 if (strcasecmp(name,
"up") == 0)
877 else if (strcasecmp(name,
"down") == 0)
879 else if (strcasecmp(name,
"left") == 0)
881 else if (strcasecmp(name,
"right") == 0)
887 LOG(
"No such output found.\n");
888 cmd_output->json_output =
sstrdup(
"{\"sucess\": false}");
896 cmd_output->json_output =
sstrdup(
"{\"sucess\": false}");
905 cmd_output->needs_tree_render =
true;
907 cmd_output->json_output =
sstrdup(
"{\"success\": true}");
917 DLOG(
"floating_mode=%s\n", floating_mode);
923 if (strcmp(floating_mode,
"toggle") == 0) {
924 DLOG(
"should toggle mode\n");
927 DLOG(
"should switch mode to %s\n", floating_mode);
928 if (strcmp(floating_mode,
"enable") == 0) {
936 cmd_output->needs_tree_render =
true;
938 cmd_output->json_output =
sstrdup(
"{\"success\": true}");
946 DLOG(
"should move workspace to output %s\n", name);
956 LOG(
"No such output\n");
957 cmd_output->json_output =
sstrdup(
"{\"sucess\": false}");
962 LOG(
"got output %p with content %p\n", output, content);
965 LOG(
"should move workspace %p / %s\n", ws, ws->
name);
968 LOG(
"Creating a new workspace to replace \"%s\" (last on its output).\n", ws->
name);
971 bool used_assignment =
false;
974 if (strcmp(assignment->
output, current_output->
name) != 0)
978 Con *workspace = NULL, *out;
981 !strcasecmp(child->name, assignment->
name));
982 if (workspace != NULL)
986 LOG(
"Creating workspace from assignment %s.\n", assignment->
name);
988 used_assignment =
true;
994 if (!used_assignment)
998 ipc_send_event(
"workspace", I3_IPC_EVENT_WORKSPACE,
"{\"change\":\"init\"}");
1005 if (workspace_was_visible) {
1009 LOG(
"workspace was visible, focusing %p / %s now\n", focus_ws, focus_ws->
name);
1016 TAILQ_FOREACH(floating_con, &(ws->floating_head), floating_windows)
1019 ipc_send_event(
"workspace", I3_IPC_EVENT_WORKSPACE,
"{\"change\":\"move\"}");
1020 if (workspace_was_visible) {
1026 cmd_output->needs_tree_render =
true;
1028 cmd_output->json_output =
sstrdup(
"{\"success\": true}");
1037 LOG(
"splitting in direction %c\n", direction[0]);
1040 cmd_output->needs_tree_render =
true;
1042 cmd_output->json_output =
sstrdup(
"{\"success\": true}");
1050 if (kill_mode_str == NULL)
1051 kill_mode_str =
"window";
1054 DLOG(
"kill_mode=%s\n", kill_mode_str);
1057 if (strcmp(kill_mode_str,
"window") == 0)
1059 else if (strcmp(kill_mode_str,
"client") == 0)
1062 ELOG(
"BUG: called with kill_mode=%s\n", kill_mode_str);
1063 cmd_output->json_output =
sstrdup(
"{\"sucess\": false}");
1077 cmd_output->needs_tree_render =
true;
1079 cmd_output->json_output =
sstrdup(
"{\"success\": true}");
1087 bool no_startup_id = (nosn != NULL);
1089 DLOG(
"should execute %s, no_startup_id = %d\n", command, no_startup_id);
1093 cmd_output->json_output =
sstrdup(
"{\"success\": true}");
1104 LOG(
"Cannot change focus while in fullscreen mode.\n");
1105 cmd_output->json_output =
sstrdup(
"{\"sucess\": false}");
1109 DLOG(
"direction = *%s*\n", direction);
1111 if (strcmp(direction,
"left") == 0)
1113 else if (strcmp(direction,
"right") == 0)
1115 else if (strcmp(direction,
"up") == 0)
1117 else if (strcmp(direction,
"down") == 0)
1120 ELOG(
"Invalid focus direction (%s)\n", direction);
1121 cmd_output->json_output =
sstrdup(
"{\"sucess\": false}");
1125 cmd_output->needs_tree_render =
true;
1127 cmd_output->json_output =
sstrdup(
"{\"success\": true}");
1138 LOG(
"Cannot change focus while in fullscreen mode.\n");
1139 cmd_output->json_output =
sstrdup(
"{\"sucess\": false}");
1143 DLOG(
"window_mode = %s\n", window_mode);
1148 if (strcmp(window_mode,
"mode_toggle") == 0) {
1150 if (current != NULL && current->
type == CT_FLOATING_CON)
1151 window_mode =
"tiling";
1152 else window_mode =
"floating";
1155 if ((strcmp(window_mode,
"floating") == 0 && current->
type != CT_FLOATING_CON) ||
1156 (strcmp(window_mode,
"tiling") == 0 && current->
type == CT_FLOATING_CON))
1164 cmd_output->needs_tree_render =
true;
1166 cmd_output->json_output =
sstrdup(
"{\"success\": true}");
1177 LOG(
"Cannot change focus while in fullscreen mode.\n");
1178 cmd_output->json_output =
sstrdup(
"{\"sucess\": false}");
1182 DLOG(
"level = %s\n", level);
1184 if (strcmp(level,
"parent") == 0)
1188 cmd_output->needs_tree_render =
true;
1190 cmd_output->json_output =
sstrdup(
"{\"success\": true}");
1202 LOG(
"Cannot change focus while in fullscreen mode.\n");
1203 cmd_output->json_output =
sstrdup(
"{\"sucess\": false}");
1210 ELOG(
"You have to specify which window/container should be focused.\n");
1211 ELOG(
"Example: [class=\"urxvt\" title=\"irssi\"] focus\n");
1214 "{\"success\":false, \"error\":\"You have to "
1215 "specify which window/container should be focused\"}");
1245 LOG(
"focusing %p / %s\n", current->
con, current->
con->
name);
1251 LOG(
"WARNING: Your criteria for the focus command matches %d containers, "
1252 "while only exactly one container can be focused at a time.\n", count);
1254 cmd_output->needs_tree_render =
true;
1256 cmd_output->json_output =
sstrdup(
"{\"success\": true}");
1264 if (fullscreen_mode == NULL)
1265 fullscreen_mode =
"output";
1266 DLOG(
"toggling fullscreen, mode = %s\n", fullscreen_mode);
1272 printf(
"matching: %p / %s\n", current->
con, current->
con->
name);
1276 cmd_output->needs_tree_render =
true;
1278 cmd_output->json_output =
sstrdup(
"{\"success\": true}");
1287 int px = atoi(move_px);
1290 DLOG(
"moving in direction %s, px %s\n", direction, move_px);
1292 DLOG(
"floating move with %d pixels\n", px);
1294 if (strcmp(direction,
"left") == 0) {
1296 }
else if (strcmp(direction,
"right") == 0) {
1298 }
else if (strcmp(direction,
"up") == 0) {
1300 }
else if (strcmp(direction,
"down") == 0) {
1306 (strcmp(direction,
"left") == 0 ?
D_LEFT :
1307 (strcmp(direction,
"up") == 0 ?
D_UP :
1309 cmd_output->needs_tree_render =
true;
1313 cmd_output->json_output =
sstrdup(
"{\"success\": true}");
1321 if (strcmp(layout_str,
"stacking") == 0)
1322 layout_str =
"stacked";
1323 DLOG(
"changing layout to %s\n", layout_str);
1325 int layout = (strcmp(layout_str,
"default") == 0 ? L_DEFAULT :
1326 (strcmp(layout_str,
"stacked") == 0 ? L_STACKED :
1339 cmd_output->needs_tree_render =
true;
1341 cmd_output->json_output =
sstrdup(
"{\"success\": true}");
1349 LOG(
"Exiting due to user command.\n");
1365 ipc_send_event(
"workspace", I3_IPC_EVENT_WORKSPACE,
"{\"change\":\"reload\"}");
1368 cmd_output->json_output =
sstrdup(
"{\"success\": true}");
1376 LOG(
"restarting i3\n");
1380 cmd_output->json_output =
sstrdup(
"{\"success\": true}");
1388 LOG(
"opening new container\n");
1392 "{\"success\":true, \"id\":%ld}", (
long int)con);
1394 cmd_output->needs_tree_render =
true;
1404 DLOG(
"name = %s\n", name);
1409 Output *current_output = NULL;
1414 assert(current_output != NULL);
1419 LOG(
"No such output found.\n");
1420 cmd_output->json_output =
sstrdup(
"{\"sucess\": false}");
1428 cmd_output->json_output =
sstrdup(
"{\"sucess\": false}");
1434 cmd_output->needs_tree_render =
true;
1436 cmd_output->json_output =
sstrdup(
"{\"success\": true}");
1449 ELOG(
"Cannot change position. The window/container is not floating\n");
1451 "{\"success\":false, \"error\":\"Cannot change position. "
1452 "The window/container is not floating.\"}");
1456 if (strcmp(method,
"absolute") == 0) {
1460 DLOG(
"moving to absolute position %d %d\n", x, y);
1462 cmd_output->needs_tree_render =
true;
1465 if (strcmp(method,
"position") == 0) {
1468 DLOG(
"moving to position %d %d\n", x, y);
1476 cmd_output->json_output =
sstrdup(
"{\"success\": true}");
1486 ELOG(
"Cannot change position. The window/container is not floating\n");
1488 "{\"success\":false, \"error\":\"Cannot change position. "
1489 "The window/container is not floating.\"}");
1492 if (strcmp(method,
"absolute") == 0) {
1495 DLOG(
"moving to absolute center\n");
1500 cmd_output->needs_tree_render =
true;
1503 if (strcmp(method,
"position") == 0) {
1507 DLOG(
"moving to center\n");
1515 cmd_output->json_output =
sstrdup(
"{\"success\": true}");
1523 DLOG(
"should move window to scratchpad\n");
1533 cmd_output->needs_tree_render =
true;
1535 cmd_output->json_output =
sstrdup(
"{\"success\": true}");
1543 DLOG(
"should show scratchpad window\n");
1555 cmd_output->needs_tree_render =
true;
1557 cmd_output->json_output =
sstrdup(
"{\"success\": true}");
1565 LOG(
"Renaming workspace \"%s\" to \"%s\"\n", old_name, new_name);
1570 !strcasecmp(child->name, old_name));
1575 cmd_output->json_output =
sstrdup(
"{\"success\": false, "
1576 "\"error\":\"Old workspace not found\"}");
1580 Con *check_dest = NULL;
1583 !strcasecmp(child->name, new_name));
1585 if (check_dest != NULL) {
1588 cmd_output->json_output =
sstrdup(
"{\"success\": false, "
1589 "\"error\":\"New workspace already exists\"}");
1596 char *endptr = NULL;
1597 long parsed_num = strtol(new_name, &endptr, 10);
1598 if (parsed_num == LONG_MIN ||
1599 parsed_num == LONG_MAX ||
1602 workspace->
num = -1;
1603 else workspace->
num = parsed_num;
1604 LOG(
"num = %d\n", workspace->
num);
1614 cmd_output->needs_tree_render =
true;
1615 cmd_output->json_output =
sstrdup(
"{\"success\": true}");
1617 ipc_send_event(
"workspace", I3_IPC_EVENT_WORKSPACE,
"{\"change\":\"rename\"}");