2 window-commands.c : irssi
4 Copyright (C) 2000 Timo Sirainen
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "module-formats.h"
31 #include "fe-windows.h"
32 #include "window-items.h"
33 #include "windows-layout.h"
34 #include "printtext.h"
36 static void window_print_binds(WINDOW_REC *win)
40 printformat_window(win, MSGLEVEL_CLIENTCRAP,
41 TXT_WINDOW_INFO_BOUND_ITEMS_HEADER);
42 for (tmp = win->bound_items; tmp != NULL; tmp = tmp->next) {
43 WINDOW_BIND_REC *bind = tmp->data;
45 printformat_window(win, MSGLEVEL_CLIENTCRAP,
46 TXT_WINDOW_INFO_BOUND_ITEM,
47 bind->name, bind->servertag,
48 bind->sticky ? "sticky" : "");
50 printformat_window(win, MSGLEVEL_CLIENTCRAP,
51 TXT_WINDOW_INFO_BOUND_ITEMS_FOOTER);
54 static void window_print_items(WINDOW_REC *win)
59 printformat_window(win, MSGLEVEL_CLIENTCRAP,
60 TXT_WINDOW_INFO_ITEMS_HEADER);
61 for (tmp = win->items; tmp != NULL; tmp = tmp->next) {
62 WI_ITEM_REC *item = tmp->data;
64 type = module_find_id_str("WINDOW ITEM TYPE", item->type);
65 printformat_window(win, MSGLEVEL_CLIENTCRAP,
67 type == NULL ? "??" : type, item->name,
68 item->server == NULL ? "" :
71 printformat_window(win, MSGLEVEL_CLIENTCRAP,
72 TXT_WINDOW_INFO_ITEMS_FOOTER);
75 static void cmd_window_info(WINDOW_REC *win)
79 printformat_window(win, MSGLEVEL_CLIENTCRAP,
80 TXT_WINDOW_INFO_HEADER);
82 /* Window reference number + sticky status */
83 if (!win->sticky_refnum) {
84 printformat_window(win, MSGLEVEL_CLIENTCRAP,
85 TXT_WINDOW_INFO_REFNUM, win->refnum);
87 printformat_window(win, MSGLEVEL_CLIENTCRAP,
88 TXT_WINDOW_INFO_REFNUM_STICKY, win->refnum);
92 if (win->name != NULL) {
93 printformat_window(win, MSGLEVEL_CLIENTCRAP,
94 TXT_WINDOW_INFO_NAME, win->name);
97 /* Window width / height */
98 printformat_window(win, MSGLEVEL_CLIENTCRAP, TXT_WINDOW_INFO_SIZE,
99 win->width, win->height);
101 /* Window immortality */
103 printformat_window(win, MSGLEVEL_CLIENTCRAP,
104 TXT_WINDOW_INFO_IMMORTAL);
107 /* Window history name */
108 if (win->history_name != NULL) {
109 printformat_window(win, MSGLEVEL_CLIENTCRAP,
110 TXT_WINDOW_INFO_HISTORY, win->history_name);
114 levelstr = win->level == 0 ?
115 g_strdup("NONE") : bits2level(win->level);
116 printformat_window(win, MSGLEVEL_CLIENTCRAP, TXT_WINDOW_INFO_LEVEL,
120 /* Active window server + sticky status */
121 if (win->servertag == NULL) {
122 printformat_window(win, MSGLEVEL_CLIENTCRAP,
123 TXT_WINDOW_INFO_SERVER,
124 win->active_server != NULL ?
125 win->active_server->tag : "NONE");
127 if (win->active_server != NULL &&
128 strcmp(win->active_server->tag, win->servertag) != 0)
129 g_warning("Active server isn't the sticky server!");
131 printformat_window(win, MSGLEVEL_CLIENTCRAP,
132 TXT_WINDOW_INFO_SERVER_STICKY,
136 /* Window theme + error status */
137 if (win->theme_name != NULL) {
138 printformat_window(win, MSGLEVEL_CLIENTCRAP,
139 TXT_WINDOW_INFO_THEME, win->theme_name,
140 win->theme != NULL ? "" : "(not loaded)");
143 /* Bound items in window */
144 if (win->bound_items != NULL)
145 window_print_binds(win);
148 if (win->items != NULL)
149 window_print_items(win);
151 signal_emit("window print info", 1, win);
153 printformat_window(win, MSGLEVEL_CLIENTCRAP,
154 TXT_WINDOW_INFO_FOOTER);
157 static void cmd_window(const char *data, void *server, WI_ITEM_REC *item)
159 while (*data == ' ') data++;
162 cmd_window_info(active_win);
163 else if (is_numeric(data, 0))
164 signal_emit("command window refnum", 3, data, server, item);
166 command_runsub("window", data, server, item);
169 /* SYNTAX: WINDOW NEW [hide] */
170 static void cmd_window_new(const char *data, void *server, WI_ITEM_REC *item)
175 g_return_if_fail(data != NULL);
177 type = (g_strncasecmp(data, "hid", 3) == 0 || g_strcasecmp(data, "tab") == 0) ? 1 :
178 (g_strcasecmp(data, "split") == 0 ? 2 : 0);
179 signal_emit("gui window create override", 1, GINT_TO_POINTER(type));
181 window = window_create(NULL, FALSE);
182 window_change_server(window, server);
185 /* SYNTAX: WINDOW CLOSE [<first> [<last>] */
186 static void cmd_window_close(const char *data)
188 GSList *tmp, *destroys;
190 int first_num, last_num;
193 if (!cmd_get_params(data, &free_arg, 2, &first, &last))
196 if ((*first != '\0' && !is_numeric(first, '\0')) ||
197 ((*last != '\0') && !is_numeric(last, '\0'))) {
198 cmd_params_free(free_arg);
202 first_num = *first == '\0' ? active_win->refnum : atoi(first);
203 last_num = *last == '\0' ? first_num : atoi(last);
205 /* get list of windows to destroy */
207 for (tmp = windows; tmp != NULL; tmp = tmp->next) {
208 WINDOW_REC *rec = tmp->data;
210 if (rec->refnum >= first_num && rec->refnum <= last_num)
211 destroys = g_slist_append(destroys, rec);
214 /* really destroy the windows */
215 while (destroys != NULL) {
216 WINDOW_REC *rec = destroys->data;
218 if (windows->next != NULL) {
222 printformat_window(rec, MSGLEVEL_CLIENTERROR,
223 TXT_WINDOW_IMMORTAL_ERROR);
227 destroys = g_slist_remove(destroys, rec);
230 cmd_params_free(free_arg);
233 /* SYNTAX: WINDOW REFNUM <number> */
234 static void cmd_window_refnum(const char *data)
238 if (!is_numeric(data, 0))
241 window = window_find_refnum(atoi(data));
243 window_set_active(window);
246 /* return the first window number with the highest activity */
247 static WINDOW_REC *window_highest_activity(WINDOW_REC *window)
249 WINDOW_REC *rec, *max_win;
251 int max_act, through;
253 g_return_val_if_fail(window != NULL, NULL);
255 max_win = NULL; max_act = 0; through = FALSE;
257 tmp = g_slist_find(windows, window);
258 for (;; tmp = tmp->next) {
264 if (through && tmp->data == window)
269 if (rec->data_level > 0 && max_act < rec->data_level) {
270 max_act = rec->data_level;
278 /* SYNTAX: WINDOW GOTO active|<number>|<name> */
279 static void cmd_window_goto(const char *data)
283 g_return_if_fail(data != NULL);
285 if (is_numeric(data, 0)) {
286 cmd_window_refnum(data);
290 if (g_strcasecmp(data, "active") == 0)
291 window = window_highest_activity(active_win);
293 window = window_find_item(active_win->active_server, data);
296 window_set_active(window);
299 /* SYNTAX: WINDOW NEXT */
300 static void cmd_window_next(void)
304 num = window_refnum_next(active_win->refnum, TRUE);
305 if (num < 1) num = windows_refnum_last();
307 window_set_active(window_find_refnum(num));
310 /* SYNTAX: WINDOW LAST */
311 static void cmd_window_last(void)
313 if (windows->next != NULL)
314 window_set_active(windows->next->data);
317 /* SYNTAX: WINDOW PREVIOUS */
318 static void cmd_window_previous(void)
322 num = window_refnum_prev(active_win->refnum, TRUE);
323 if (num < 1) num = window_refnum_next(0, TRUE);
325 window_set_active(window_find_refnum(num));
328 /* SYNTAX: WINDOW LEVEL [<level>] */
329 static void cmd_window_level(const char *data)
333 g_return_if_fail(data != NULL);
335 window_set_level(active_win, combine_level(active_win->level, data));
337 level = active_win->level == 0 ? g_strdup("NONE") :
338 bits2level(active_win->level);
339 printformat_window(active_win, MSGLEVEL_CLIENTNOTICE,
340 TXT_WINDOW_LEVEL, level);
344 /* SYNTAX: WINDOW IMMORTAL on|off|toggle */
345 static void cmd_window_immortal(const char *data)
349 if (g_strcasecmp(data, "ON") == 0)
351 else if (g_strcasecmp(data, "OFF") == 0)
353 else if (g_strcasecmp(data, "TOGGLE") == 0)
354 set = !active_win->immortal;
356 printformat(NULL, NULL, MSGLEVEL_CLIENTERROR, TXT_NOT_TOGGLE);
361 window_set_immortal(active_win, TRUE);
362 printformat_window(active_win, MSGLEVEL_CLIENTNOTICE,
363 TXT_WINDOW_SET_IMMORTAL);
365 window_set_immortal(active_win, FALSE);
366 printformat_window(active_win, MSGLEVEL_CLIENTNOTICE,
367 TXT_WINDOW_UNSET_IMMORTAL);
371 /* SYNTAX: WINDOW SERVER [-sticky | -unsticky] <tag> */
372 static void cmd_window_server(const char *data)
379 if (!cmd_get_params(data, &free_arg, 1 | PARAM_FLAG_OPTIONS,
380 "window server", &optlist, &tag))
383 if (*tag == '\0' && active_win->active_server != NULL &&
384 (g_hash_table_lookup(optlist, "sticky") != NULL ||
385 g_hash_table_lookup(optlist, "unsticky") != NULL)) {
386 tag = active_win->active_server->tag;
390 cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
391 server = server_find_tag(tag);
393 if (g_hash_table_lookup(optlist, "unsticky") != NULL &&
394 active_win->servertag != NULL) {
395 g_free_and_null(active_win->servertag);
396 printformat_window(active_win, MSGLEVEL_CLIENTNOTICE,
397 TXT_UNSET_SERVER_STICKY);
400 if (active_win->servertag != NULL &&
401 g_hash_table_lookup(optlist, "sticky") == NULL) {
402 printformat_window(active_win, MSGLEVEL_CLIENTERROR,
403 TXT_ERROR_SERVER_STICKY);
404 } else if (server == NULL) {
405 printformat_window(active_win, MSGLEVEL_CLIENTNOTICE,
406 TXT_UNKNOWN_SERVER_TAG, tag);
407 } else if (active_win->active == NULL) {
408 window_change_server(active_win, server);
409 if (g_hash_table_lookup(optlist, "sticky") != NULL) {
410 g_free_not_null(active_win->servertag);
411 active_win->servertag = g_strdup(server->tag);
412 printformat_window(active_win, MSGLEVEL_CLIENTNOTICE,
413 TXT_SET_SERVER_STICKY, server->tag);
415 printformat_window(active_win, MSGLEVEL_CLIENTNOTICE,
417 server->tag, server->connrec->address,
418 server->connrec->chatnet == NULL ? "" :
419 server->connrec->chatnet);
422 cmd_params_free(free_arg);
425 static void cmd_window_item(const char *data, void *server, WI_ITEM_REC *item)
427 command_runsub("window item", data, server, item);
430 /* SYNTAX: WINDOW ITEM PREV */
431 static void cmd_window_item_prev(void)
433 window_item_prev(active_win);
436 /* SYNTAX: WINDOW ITEM NEXT */
437 static void cmd_window_item_next(void)
439 window_item_next(active_win);
442 /* SYNTAX: WINDOW ITEM GOTO <name> */
443 static void cmd_window_item_goto(const char *data, SERVER_REC *server)
447 item = window_item_find_window(active_win, server, data);
449 window_item_set_active(active_win, item);
452 /* SYNTAX: WINDOW ITEM MOVE <number>|<name> */
453 static void cmd_window_item_move(const char *data, SERVER_REC *server,
460 if (!cmd_get_params(data, &free_arg, 1, &target))
463 if (is_numeric(target, '\0')) {
464 /* move current window item to specified window */
465 window = window_find_refnum(atoi(target));
467 /* move specified window item to current window */
468 item = window_item_find(server, target);
471 if (window != NULL && item != NULL)
472 window_item_set_active(window, item);
474 cmd_params_free(free_arg);
477 /* SYNTAX: WINDOW NUMBER [-sticky] <number> */
478 static void cmd_window_number(const char *data)
485 if (!cmd_get_params(data, &free_arg, 1 | PARAM_FLAG_OPTIONS,
486 "window number", &optlist, &refnum))
490 cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
494 printformat_window(active_win, MSGLEVEL_CLIENTNOTICE,
497 window_set_refnum(active_win, num);
498 active_win->sticky_refnum =
499 g_hash_table_lookup(optlist, "sticky") != NULL;
502 cmd_params_free(free_arg);
505 /* SYNTAX: WINDOW NAME <name> */
506 static void cmd_window_name(const char *data)
508 if (window_find_name(data) == NULL)
509 window_set_name(active_win, data);
511 printformat_window(active_win, MSGLEVEL_CLIENTERROR,
512 TXT_WINDOW_NAME_NOT_UNIQUE, data);
516 /* SYNTAX: WINDOW HISTORY <name> */
517 void cmd_window_history(const char *data)
519 window_set_history(active_win, data);
522 /* we're moving the first window to last - move the first contiguous block
523 of refnums to left. Like if there's windows 1..5 and 7..10, move 1 to
524 11, 2..5 to 1..4 and leave 7..10 alone */
525 static void window_refnums_move_left(WINDOW_REC *move_window)
528 int refnum, new_refnum;
530 new_refnum = windows_refnum_last();
531 for (refnum = move_window->refnum+1; refnum <= new_refnum; refnum++) {
532 window = window_find_refnum(refnum);
533 if (window == NULL) {
538 window_set_refnum(window, refnum-1);
541 window_set_refnum(move_window, new_refnum);
544 /* we're moving the last window to first - make some space so we can use the
546 static void window_refnums_move_right(WINDOW_REC *move_window)
549 int refnum, new_refnum;
552 if (window_find_refnum(new_refnum) == NULL) {
553 window_set_refnum(move_window, new_refnum);
557 /* find the first unused refnum, like if there's windows
558 1..5 and 7..10, we only need to move 1..5 to 2..6 */
560 while (move_window->refnum == refnum ||
561 window_find_refnum(refnum) != NULL) refnum++;
564 while (refnum >= new_refnum) {
565 window = window_find_refnum(refnum);
566 window_set_refnum(window, refnum+1);
571 window_set_refnum(move_window, new_refnum);
574 /* SYNTAX: WINDOW MOVE PREV */
575 static void cmd_window_move_prev(void)
579 refnum = window_refnum_prev(active_win->refnum, FALSE);
581 window_set_refnum(active_win, refnum);
585 window_refnums_move_left(active_win);
588 /* SYNTAX: WINDOW MOVE NEXT */
589 static void cmd_window_move_next(void)
593 refnum = window_refnum_next(active_win->refnum, FALSE);
595 window_set_refnum(active_win, refnum);
599 window_refnums_move_right(active_win);
602 /* SYNTAX: WINDOW MOVE <number>|<direction> */
603 static void cmd_window_move(const char *data, SERVER_REC *server, WI_ITEM_REC *item)
605 int new_refnum, refnum;
607 if (!is_numeric(data, 0)) {
608 command_runsub("window move", data, server, item);
612 new_refnum = atoi(data);
613 if (new_refnum > active_win->refnum) {
615 refnum = window_refnum_next(active_win->refnum, FALSE);
616 if (refnum == -1 || refnum > new_refnum)
619 window_set_refnum(active_win, refnum);
623 refnum = window_refnum_prev(active_win->refnum, FALSE);
624 if (refnum == -1 || refnum < new_refnum)
627 window_set_refnum(active_win, refnum);
632 /* SYNTAX: WINDOW LIST */
633 static void cmd_window_list(void)
635 GSList *tmp, *sorted;
638 sorted = windows_get_sorted();
639 printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, TXT_WINDOWLIST_HEADER);
640 for (tmp = sorted; tmp != NULL; tmp = tmp->next) {
641 WINDOW_REC *rec = tmp->data;
643 levelstr = bits2level(rec->level);
644 printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, TXT_WINDOWLIST_LINE,
645 rec->refnum, rec->name == NULL ? "" : rec->name,
646 rec->active == NULL ? "" : rec->active->name,
647 rec->active_server == NULL ? "" : ((SERVER_REC *) rec->active_server)->tag,
651 g_slist_free(sorted);
652 printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, TXT_WINDOWLIST_FOOTER);
655 /* SYNTAX: WINDOW THEME [-delete] [<name>] */
656 static void cmd_window_theme(const char *data)
663 if (!cmd_get_params(data, &free_arg, 1 | PARAM_FLAG_OPTIONS,
664 "window theme", &optlist, &name))
667 if (g_hash_table_lookup(optlist, "delete") != NULL) {
668 g_free_and_null(active_win->theme_name);
670 printformat_window(active_win, MSGLEVEL_CLIENTNOTICE,
671 TXT_WINDOW_THEME_REMOVED);
672 } else if (*name == '\0') {
673 if (active_win->theme == NULL) {
674 printformat_window(active_win, MSGLEVEL_CLIENTNOTICE,
675 TXT_WINDOW_THEME_DEFAULT);
677 theme = active_win->theme;
678 printformat_window(active_win, MSGLEVEL_CLIENTNOTICE,
680 theme->name, theme->path);
683 g_free_not_null(active_win->theme_name);
684 active_win->theme_name = g_strdup(data);
686 active_win->theme = theme = theme_load(data);
688 printformat_window(active_win, MSGLEVEL_CLIENTNOTICE,
689 TXT_WINDOW_THEME_CHANGED,
690 theme->name, theme->path);
692 printformat_window(active_win, MSGLEVEL_CLIENTNOTICE,
693 TXT_THEME_NOT_FOUND, data);
697 cmd_params_free(free_arg);
700 static void cmd_layout(const char *data, SERVER_REC *server, WI_ITEM_REC *item)
702 command_runsub("layout", data, server, item);
705 /* SYNTAX: FOREACH WINDOW <command> */
706 static void cmd_foreach_window(const char *data)
713 list = g_slist_copy(windows);
714 while (list != NULL) {
715 WINDOW_REC *rec = list->data;
718 signal_emit("send command", 3, data, rec->active_server,
720 list = g_slist_remove(list, list->data);
726 void window_commands_init(void)
728 command_bind("window", NULL, (SIGNAL_FUNC) cmd_window);
729 command_bind("window new", NULL, (SIGNAL_FUNC) cmd_window_new);
730 command_bind("window close", NULL, (SIGNAL_FUNC) cmd_window_close);
731 command_bind("window kill", NULL, (SIGNAL_FUNC) cmd_window_close);
732 command_bind("window server", NULL, (SIGNAL_FUNC) cmd_window_server);
733 command_bind("window refnum", NULL, (SIGNAL_FUNC) cmd_window_refnum);
734 command_bind("window goto", NULL, (SIGNAL_FUNC) cmd_window_goto);
735 command_bind("window previous", NULL, (SIGNAL_FUNC) cmd_window_previous);
736 command_bind("window next", NULL, (SIGNAL_FUNC) cmd_window_next);
737 command_bind("window last", NULL, (SIGNAL_FUNC) cmd_window_last);
738 command_bind("window level", NULL, (SIGNAL_FUNC) cmd_window_level);
739 command_bind("window immortal", NULL, (SIGNAL_FUNC) cmd_window_immortal);
740 command_bind("window item", NULL, (SIGNAL_FUNC) cmd_window_item);
741 command_bind("window item prev", NULL, (SIGNAL_FUNC) cmd_window_item_prev);
742 command_bind("window item next", NULL, (SIGNAL_FUNC) cmd_window_item_next);
743 command_bind("window item goto", NULL, (SIGNAL_FUNC) cmd_window_item_goto);
744 command_bind("window item move", NULL, (SIGNAL_FUNC) cmd_window_item_move);
745 command_bind("window number", NULL, (SIGNAL_FUNC) cmd_window_number);
746 command_bind("window name", NULL, (SIGNAL_FUNC) cmd_window_name);
747 command_bind("window history", NULL, (SIGNAL_FUNC) cmd_window_history);
748 command_bind("window move", NULL, (SIGNAL_FUNC) cmd_window_move);
749 command_bind("window move prev", NULL, (SIGNAL_FUNC) cmd_window_move_prev);
750 command_bind("window move next", NULL, (SIGNAL_FUNC) cmd_window_move_next);
751 command_bind("window list", NULL, (SIGNAL_FUNC) cmd_window_list);
752 command_bind("window theme", NULL, (SIGNAL_FUNC) cmd_window_theme);
753 command_bind("layout", NULL, (SIGNAL_FUNC) cmd_layout);
754 /* SYNTAX: LAYOUT SAVE */
755 command_bind("layout save", NULL, (SIGNAL_FUNC) windows_layout_save);
756 /* SYNTAX: LAYOUT RESET */
757 command_bind("layout reset", NULL, (SIGNAL_FUNC) windows_layout_reset);
758 command_bind("foreach window", NULL, (SIGNAL_FUNC) cmd_foreach_window);
760 command_set_options("window number", "sticky");
761 command_set_options("window server", "sticky unsticky");
762 command_set_options("window theme", "delete");
765 void window_commands_deinit(void)
767 command_unbind("window", (SIGNAL_FUNC) cmd_window);
768 command_unbind("window new", (SIGNAL_FUNC) cmd_window_new);
769 command_unbind("window close", (SIGNAL_FUNC) cmd_window_close);
770 command_unbind("window kill", (SIGNAL_FUNC) cmd_window_close);
771 command_unbind("window server", (SIGNAL_FUNC) cmd_window_server);
772 command_unbind("window refnum", (SIGNAL_FUNC) cmd_window_refnum);
773 command_unbind("window goto", (SIGNAL_FUNC) cmd_window_goto);
774 command_unbind("window previous", (SIGNAL_FUNC) cmd_window_previous);
775 command_unbind("window next", (SIGNAL_FUNC) cmd_window_next);
776 command_unbind("window last", (SIGNAL_FUNC) cmd_window_last);
777 command_unbind("window level", (SIGNAL_FUNC) cmd_window_level);
778 command_unbind("window immortal", (SIGNAL_FUNC) cmd_window_immortal);
779 command_unbind("window item", (SIGNAL_FUNC) cmd_window_item);
780 command_unbind("window item prev", (SIGNAL_FUNC) cmd_window_item_prev);
781 command_unbind("window item next", (SIGNAL_FUNC) cmd_window_item_next);
782 command_unbind("window item goto", (SIGNAL_FUNC) cmd_window_item_goto);
783 command_unbind("window item move", (SIGNAL_FUNC) cmd_window_item_move);
784 command_unbind("window number", (SIGNAL_FUNC) cmd_window_number);
785 command_unbind("window name", (SIGNAL_FUNC) cmd_window_name);
786 command_unbind("window history", (SIGNAL_FUNC) cmd_window_history);
787 command_unbind("window move", (SIGNAL_FUNC) cmd_window_move);
788 command_unbind("window move prev", (SIGNAL_FUNC) cmd_window_move_prev);
789 command_unbind("window move next", (SIGNAL_FUNC) cmd_window_move_next);
790 command_unbind("window list", (SIGNAL_FUNC) cmd_window_list);
791 command_unbind("window theme", (SIGNAL_FUNC) cmd_window_theme);
792 command_unbind("layout", (SIGNAL_FUNC) cmd_layout);
793 command_unbind("layout save", (SIGNAL_FUNC) windows_layout_save);
794 command_unbind("layout reset", (SIGNAL_FUNC) windows_layout_reset);
795 command_unbind("foreach window", (SIGNAL_FUNC) cmd_foreach_window);