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 along
17 with this program; if not, write to the Free Software Foundation, Inc.,
18 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #include "module-formats.h"
32 #include "fe-windows.h"
33 #include "window-items.h"
34 #include "windows-layout.h"
35 #include "printtext.h"
37 static void window_print_binds(WINDOW_REC *win)
41 printformat_window(win, MSGLEVEL_CLIENTCRAP,
42 TXT_WINDOW_INFO_BOUND_ITEMS_HEADER);
43 for (tmp = win->bound_items; tmp != NULL; tmp = tmp->next) {
44 WINDOW_BIND_REC *bind = tmp->data;
46 printformat_window(win, MSGLEVEL_CLIENTCRAP,
47 TXT_WINDOW_INFO_BOUND_ITEM,
48 bind->name, bind->servertag,
49 bind->sticky ? "sticky" : "");
51 printformat_window(win, MSGLEVEL_CLIENTCRAP,
52 TXT_WINDOW_INFO_BOUND_ITEMS_FOOTER);
55 static void window_print_items(WINDOW_REC *win)
60 printformat_window(win, MSGLEVEL_CLIENTCRAP,
61 TXT_WINDOW_INFO_ITEMS_HEADER);
62 for (tmp = win->items; tmp != NULL; tmp = tmp->next) {
63 WI_ITEM_REC *item = tmp->data;
65 type = module_find_id_str("WINDOW ITEM TYPE", item->type);
66 printformat_window(win, MSGLEVEL_CLIENTCRAP,
68 type == NULL ? "??" : type,
70 item->server == NULL ? "" :
73 printformat_window(win, MSGLEVEL_CLIENTCRAP,
74 TXT_WINDOW_INFO_ITEMS_FOOTER);
77 static void cmd_window_info(WINDOW_REC *win)
81 printformat_window(win, MSGLEVEL_CLIENTCRAP,
82 TXT_WINDOW_INFO_HEADER);
84 /* Window reference number + sticky status */
85 if (!win->sticky_refnum) {
86 printformat_window(win, MSGLEVEL_CLIENTCRAP,
87 TXT_WINDOW_INFO_REFNUM, win->refnum);
89 printformat_window(win, MSGLEVEL_CLIENTCRAP,
90 TXT_WINDOW_INFO_REFNUM_STICKY, win->refnum);
94 if (win->name != NULL) {
95 printformat_window(win, MSGLEVEL_CLIENTCRAP,
96 TXT_WINDOW_INFO_NAME, win->name);
99 /* Window width / height */
100 printformat_window(win, MSGLEVEL_CLIENTCRAP, TXT_WINDOW_INFO_SIZE,
101 win->width, win->height);
103 /* Window immortality */
105 printformat_window(win, MSGLEVEL_CLIENTCRAP,
106 TXT_WINDOW_INFO_IMMORTAL);
109 /* Window history name */
110 if (win->history_name != NULL) {
111 printformat_window(win, MSGLEVEL_CLIENTCRAP,
112 TXT_WINDOW_INFO_HISTORY, win->history_name);
116 levelstr = win->level == 0 ?
117 g_strdup("NONE") : bits2level(win->level);
118 printformat_window(win, MSGLEVEL_CLIENTCRAP, TXT_WINDOW_INFO_LEVEL,
122 /* Active window server + sticky status */
123 if (win->servertag == NULL) {
124 printformat_window(win, MSGLEVEL_CLIENTCRAP,
125 TXT_WINDOW_INFO_SERVER,
126 win->active_server != NULL ?
127 win->active_server->tag : "NONE");
129 if (win->active_server != NULL &&
130 strcmp(win->active_server->tag, win->servertag) != 0)
131 g_warning("Active server isn't the sticky server!");
133 printformat_window(win, MSGLEVEL_CLIENTCRAP,
134 TXT_WINDOW_INFO_SERVER_STICKY,
138 /* Window theme + error status */
139 if (win->theme_name != NULL) {
140 printformat_window(win, MSGLEVEL_CLIENTCRAP,
141 TXT_WINDOW_INFO_THEME, win->theme_name,
142 win->theme != NULL ? "" : "(not loaded)");
145 /* Bound items in window */
146 if (win->bound_items != NULL)
147 window_print_binds(win);
150 if (win->items != NULL)
151 window_print_items(win);
153 signal_emit("window print info", 1, win);
155 printformat_window(win, MSGLEVEL_CLIENTCRAP,
156 TXT_WINDOW_INFO_FOOTER);
159 static void cmd_window(const char *data, void *server, WI_ITEM_REC *item)
161 while (*data == ' ') data++;
164 cmd_window_info(active_win);
165 else if (is_numeric(data, 0))
166 signal_emit("command window refnum", 3, data, server, item);
168 command_runsub("window", data, server, item);
171 /* SYNTAX: WINDOW NEW [HIDDEN|SPLIT] */
172 static void cmd_window_new(const char *data, void *server, WI_ITEM_REC *item)
177 g_return_if_fail(data != NULL);
179 type = (g_ascii_strncasecmp(data, "hid", 3) == 0 || g_ascii_strcasecmp(data, "tab") == 0) ? 1 :
180 (g_ascii_strcasecmp(data, "split") == 0 ? 2 : 0);
181 signal_emit("gui window create override", 1, GINT_TO_POINTER(type));
183 window = window_create(NULL, FALSE);
184 window_change_server(window, server);
187 /* SYNTAX: WINDOW CLOSE [<first> [<last>]] */
188 static void cmd_window_close(const char *data)
190 GSList *tmp, *destroys;
192 int first_num, last_num;
195 if (!cmd_get_params(data, &free_arg, 2, &first, &last))
198 if ((*first != '\0' && !is_numeric(first, '\0')) ||
199 ((*last != '\0') && !is_numeric(last, '\0'))) {
200 cmd_params_free(free_arg);
204 first_num = *first == '\0' ? active_win->refnum : atoi(first);
205 last_num = *last == '\0' ? first_num : atoi(last);
207 /* get list of windows to destroy */
209 for (tmp = windows; tmp != NULL; tmp = tmp->next) {
210 WINDOW_REC *rec = tmp->data;
212 if (rec->refnum >= first_num && rec->refnum <= last_num)
213 destroys = g_slist_append(destroys, rec);
216 /* really destroy the windows */
217 while (destroys != NULL) {
218 WINDOW_REC *rec = destroys->data;
220 if (windows->next != NULL) {
224 printformat_window(rec, MSGLEVEL_CLIENTERROR,
225 TXT_WINDOW_IMMORTAL_ERROR);
229 destroys = g_slist_remove(destroys, rec);
232 cmd_params_free(free_arg);
235 /* SYNTAX: WINDOW REFNUM <number> */
236 static void cmd_window_refnum(const char *data)
240 if (!is_numeric(data, 0))
243 window = window_find_refnum(atoi(data));
245 window_set_active(window);
249 * return the window with the highest activity
251 * If ignore_refnum is true, the most recently active window with the highest
252 * activity will be returned. If ignore_refnum is false, the refnum will be used
253 * to break ties between windows with equally high activity.
255 static WINDOW_REC *window_highest_activity(WINDOW_REC *window,
258 WINDOW_REC *rec, *max_win;
260 int max_act, max_ref, through;
262 g_return_val_if_fail(window != NULL, NULL);
264 max_win = NULL; max_act = 0; max_ref = 0; through = FALSE;
266 tmp = g_slist_find(windows, window);
267 for (;; tmp = tmp->next) {
273 if (through && tmp->data == window)
280 rec->data_level > 0 && max_act < rec->data_level) {
281 max_act = rec->data_level;
285 /* windows with lower refnums break ties */
286 else if (!ignore_refnum &&
287 rec->data_level > 0 &&
288 (rec->data_level > max_act ||
289 (rec->data_level == max_act && rec->refnum < max_ref))) {
290 max_act = rec->data_level;
292 max_ref = rec->refnum;
299 static inline int is_nearer(int r1, int r2)
301 int a = r2 < active_win->refnum;
304 if (r1 > active_win->refnum)
310 static WINDOW_REC *window_find_item_cycle(SERVER_REC *server, const char *name)
312 WINDOW_REC *rec, *win;
317 tmp = g_slist_find(windows, active_win);
319 for (;; tmp = tmp->next) {
323 if (tmp->data == active_win)
328 if (window_item_find_window(rec, server, name) != NULL &&
329 (win == NULL || is_nearer(rec->refnum, win->refnum))) {
331 if (server != NULL) break;
338 /* SYNTAX: WINDOW GOTO active|<number>|<name> */
339 static void cmd_window_goto(const char *data)
345 g_return_if_fail(data != NULL);
347 if (is_numeric(data, 0)) {
348 cmd_window_refnum(data);
352 if (!cmd_get_params(data, &free_arg, 1, &target))
355 if (g_ascii_strcasecmp(target, "active") == 0)
356 window = window_highest_activity(active_win,
357 settings_get_bool("active_window_ignore_refnum"));
359 window = window_find_name(target);
360 if (window == NULL && active_win->active_server != NULL)
361 window = window_find_item_cycle(active_win->active_server, target);
363 window = window_find_item_cycle(NULL, target);
367 window_set_active(window);
369 cmd_params_free(free_arg);
372 /* SYNTAX: WINDOW NEXT */
373 static void cmd_window_next(void)
377 num = window_refnum_next(active_win->refnum, TRUE);
378 if (num < 1) num = windows_refnum_last();
380 window_set_active(window_find_refnum(num));
383 /* SYNTAX: WINDOW LAST */
384 static void cmd_window_last(void)
386 if (windows->next != NULL)
387 window_set_active(windows->next->data);
390 /* SYNTAX: WINDOW PREVIOUS */
391 static void cmd_window_previous(void)
395 num = window_refnum_prev(active_win->refnum, TRUE);
396 if (num < 1) num = window_refnum_next(0, TRUE);
398 window_set_active(window_find_refnum(num));
401 /* SYNTAX: WINDOW LEVEL [<level>] */
402 static void cmd_window_level(const char *data)
406 g_return_if_fail(data != NULL);
408 window_set_level(active_win, combine_level(active_win->level, data));
410 level = active_win->level == 0 ? g_strdup("NONE") :
411 bits2level(active_win->level);
412 printformat_window(active_win, MSGLEVEL_CLIENTNOTICE,
413 TXT_WINDOW_LEVEL, level);
417 /* SYNTAX: WINDOW IMMORTAL on|off|toggle */
418 static void cmd_window_immortal(const char *data)
423 set = active_win->immortal;
424 else if (g_ascii_strcasecmp(data, "ON") == 0)
426 else if (g_ascii_strcasecmp(data, "OFF") == 0)
428 else if (g_ascii_strcasecmp(data, "TOGGLE") == 0)
429 set = !active_win->immortal;
431 printformat_window(active_win, MSGLEVEL_CLIENTERROR,
437 window_set_immortal(active_win, TRUE);
438 printformat_window(active_win, MSGLEVEL_CLIENTNOTICE,
439 TXT_WINDOW_SET_IMMORTAL);
441 window_set_immortal(active_win, FALSE);
442 printformat_window(active_win, MSGLEVEL_CLIENTNOTICE,
443 TXT_WINDOW_UNSET_IMMORTAL);
447 /* SYNTAX: WINDOW SERVER [-sticky | -unsticky] <tag> */
448 static void cmd_window_server(const char *data)
455 if (!cmd_get_params(data, &free_arg, 1 | PARAM_FLAG_OPTIONS,
456 "window server", &optlist, &tag))
459 if (*tag == '\0' && active_win->active_server != NULL &&
460 (g_hash_table_lookup(optlist, "sticky") != NULL ||
461 g_hash_table_lookup(optlist, "unsticky") != NULL)) {
462 tag = active_win->active_server->tag;
466 cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
467 server = server_find_tag(tag);
469 server = server_find_lookup_tag(tag);
471 if (g_hash_table_lookup(optlist, "unsticky") != NULL &&
472 active_win->servertag != NULL) {
473 g_free_and_null(active_win->servertag);
474 printformat_window(active_win, MSGLEVEL_CLIENTNOTICE,
475 TXT_UNSET_SERVER_STICKY);
478 if (active_win->servertag != NULL &&
479 g_hash_table_lookup(optlist, "sticky") == NULL) {
480 printformat_window(active_win, MSGLEVEL_CLIENTERROR,
481 TXT_ERROR_SERVER_STICKY);
482 } else if (server == NULL) {
483 printformat_window(active_win, MSGLEVEL_CLIENTNOTICE,
484 TXT_UNKNOWN_SERVER_TAG, tag);
485 } else if (active_win->active == NULL) {
486 window_change_server(active_win, server);
487 if (g_hash_table_lookup(optlist, "sticky") != NULL) {
488 g_free_not_null(active_win->servertag);
489 active_win->servertag = g_strdup(server->tag);
490 printformat_window(active_win, MSGLEVEL_CLIENTNOTICE,
491 TXT_SET_SERVER_STICKY, server->tag);
493 printformat_window(active_win, MSGLEVEL_CLIENTNOTICE,
495 server->tag, server->connrec->address,
496 server->connrec->chatnet == NULL ? "" :
497 server->connrec->chatnet);
500 cmd_params_free(free_arg);
503 static void cmd_window_item(const char *data, void *server, WI_ITEM_REC *item)
505 while (*data == ' ') data++;
507 if (is_numeric(data, '\0'))
508 signal_emit("command window item goto", 3, data, server, item);
510 command_runsub("window item", data, server, item);
513 /* SYNTAX: WINDOW ITEM PREV */
514 static void cmd_window_item_prev(void)
516 window_item_prev(active_win);
519 /* SYNTAX: WINDOW ITEM NEXT */
520 static void cmd_window_item_next(void)
522 window_item_next(active_win);
525 /* SYNTAX: WINDOW ITEM GOTO <number>|<name> */
526 static void cmd_window_item_goto(const char *data, SERVER_REC *server)
533 if (!cmd_get_params(data, &free_arg, 1, &target))
536 if (is_numeric(target, '\0')) {
537 /* change to specified number */
538 tmp = g_slist_nth(active_win->items, atoi(target)-1);
539 item = tmp == NULL ? NULL : tmp->data;
541 item = window_item_find_window(active_win, server, target);
545 window_item_set_active(active_win, item);
547 cmd_params_free(free_arg);
550 /* SYNTAX: WINDOW ITEM MOVE <number>|<name> */
551 static void cmd_window_item_move(const char *data, SERVER_REC *server,
558 if (!cmd_get_params(data, &free_arg, 1, &target))
561 if (is_numeric(target, '\0')) {
562 /* move current window item to specified window */
563 window = window_find_refnum(atoi(target));
565 /* move specified window item to current window */
566 item = window_item_find(server, target);
569 if (window != NULL && item != NULL)
570 window_item_set_active(window, item);
572 cmd_params_free(free_arg);
575 /* SYNTAX: WINDOW NUMBER [-sticky] <number> */
576 static void cmd_window_number(const char *data)
583 if (!cmd_get_params(data, &free_arg, 1 | PARAM_FLAG_OPTIONS,
584 "window number", &optlist, &refnum))
588 cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
592 printformat_window(active_win, MSGLEVEL_CLIENTNOTICE,
595 window_set_refnum(active_win, num);
596 active_win->sticky_refnum =
597 g_hash_table_lookup(optlist, "sticky") != NULL;
600 cmd_params_free(free_arg);
603 /* SYNTAX: WINDOW NAME <name> */
604 static void cmd_window_name(const char *data)
608 win = window_find_name(data);
609 if (win == NULL || win == active_win)
610 window_set_name(active_win, data);
611 else if (active_win->name == NULL ||
612 strcmp(active_win->name, data) != 0) {
613 printformat_window(active_win, MSGLEVEL_CLIENTERROR,
614 TXT_WINDOW_NAME_NOT_UNIQUE, data);
618 /* SYNTAX: WINDOW HISTORY <name> */
619 void cmd_window_history(const char *data)
621 window_set_history(active_win, data);
624 /* we're moving the first window to last - move the first contiguous block
625 of refnums to left. Like if there's windows 1..5 and 7..10, move 1 to
626 11, 2..5 to 1..4 and leave 7..10 alone */
627 static void window_refnums_move_left(WINDOW_REC *move_window)
630 int refnum, new_refnum;
632 new_refnum = windows_refnum_last();
633 for (refnum = move_window->refnum+1; refnum <= new_refnum; refnum++) {
634 window = window_find_refnum(refnum);
635 if (window == NULL) {
640 window_set_refnum(window, refnum-1);
643 window_set_refnum(move_window, new_refnum);
646 /* we're moving the last window to first - make some space so we can use the
648 static void window_refnums_move_right(WINDOW_REC *move_window)
651 int refnum, new_refnum;
654 if (window_find_refnum(new_refnum) == NULL) {
655 window_set_refnum(move_window, new_refnum);
659 /* find the first unused refnum, like if there's windows
660 1..5 and 7..10, we only need to move 1..5 to 2..6 */
662 while (move_window->refnum == refnum ||
663 window_find_refnum(refnum) != NULL) refnum++;
666 while (refnum >= new_refnum) {
667 window = window_find_refnum(refnum);
668 window_set_refnum(window, refnum+1);
673 window_set_refnum(move_window, new_refnum);
676 /* SYNTAX: WINDOW MOVE PREV */
677 static void cmd_window_move_prev(void)
681 refnum = window_refnum_prev(active_win->refnum, FALSE);
683 window_set_refnum(active_win, refnum);
687 window_refnums_move_left(active_win);
690 /* SYNTAX: WINDOW MOVE NEXT */
691 static void cmd_window_move_next(void)
695 refnum = window_refnum_next(active_win->refnum, FALSE);
697 window_set_refnum(active_win, refnum);
701 window_refnums_move_right(active_win);
704 static void active_window_move_to(int new_refnum)
708 if (new_refnum > active_win->refnum) {
710 refnum = window_refnum_next(active_win->refnum, FALSE);
711 if (refnum == -1 || refnum > new_refnum)
714 window_set_refnum(active_win, refnum);
718 refnum = window_refnum_prev(active_win->refnum, FALSE);
719 if (refnum == -1 || refnum < new_refnum)
722 window_set_refnum(active_win, refnum);
727 /* SYNTAX: WINDOW MOVE FIRST */
728 static void cmd_window_move_first(void)
730 active_window_move_to(1);
733 /* SYNTAX: WINDOW MOVE LAST */
734 static void cmd_window_move_last(void)
736 active_window_move_to(windows_refnum_last());
739 /* SYNTAX: WINDOW MOVE <number>|<direction> */
740 static void cmd_window_move(const char *data, SERVER_REC *server, WI_ITEM_REC *item)
742 if (!is_numeric(data, 0)) {
743 command_runsub("window move", data, server, item);
747 active_window_move_to(atoi(data));
750 /* SYNTAX: WINDOW LIST */
751 static void cmd_window_list(void)
753 GSList *tmp, *sorted;
756 sorted = windows_get_sorted();
757 printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, TXT_WINDOWLIST_HEADER);
758 for (tmp = sorted; tmp != NULL; tmp = tmp->next) {
759 WINDOW_REC *rec = tmp->data;
761 levelstr = bits2level(rec->level);
762 printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, TXT_WINDOWLIST_LINE,
763 rec->refnum, rec->name == NULL ? "" : rec->name,
764 rec->active == NULL ? "" : rec->active->visible_name,
765 rec->active_server == NULL ? "" : ((SERVER_REC *) rec->active_server)->tag,
769 g_slist_free(sorted);
770 printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, TXT_WINDOWLIST_FOOTER);
773 /* SYNTAX: WINDOW THEME [-delete] [<name>] */
774 static void cmd_window_theme(const char *data)
781 if (!cmd_get_params(data, &free_arg, 1 | PARAM_FLAG_OPTIONS,
782 "window theme", &optlist, &name))
785 if (g_hash_table_lookup(optlist, "delete") != NULL) {
786 g_free_and_null(active_win->theme_name);
788 printformat_window(active_win, MSGLEVEL_CLIENTNOTICE,
789 TXT_WINDOW_THEME_REMOVED);
790 } else if (*name == '\0') {
791 if (active_win->theme == NULL) {
792 printformat_window(active_win, MSGLEVEL_CLIENTNOTICE,
793 TXT_WINDOW_THEME_DEFAULT);
795 theme = active_win->theme;
796 printformat_window(active_win, MSGLEVEL_CLIENTNOTICE,
798 theme->name, theme->path);
801 g_free_not_null(active_win->theme_name);
802 active_win->theme_name = g_strdup(data);
804 active_win->theme = theme = theme_load(data);
806 printformat_window(active_win, MSGLEVEL_CLIENTNOTICE,
807 TXT_WINDOW_THEME_CHANGED,
808 theme->name, theme->path);
810 printformat_window(active_win, MSGLEVEL_CLIENTNOTICE,
811 TXT_THEME_NOT_FOUND, data);
815 cmd_params_free(free_arg);
818 static void cmd_layout(const char *data, SERVER_REC *server, WI_ITEM_REC *item)
820 command_runsub("layout", data, server, item);
823 /* SYNTAX: FOREACH WINDOW <command> */
824 static void cmd_foreach_window(const char *data)
831 list = g_slist_copy(windows);
832 while (list != NULL) {
833 WINDOW_REC *rec = list->data;
836 signal_emit("send command", 3, data, rec->active_server,
838 list = g_slist_remove(list, list->data);
841 if (g_slist_find(windows, old) != NULL)
845 void window_commands_init(void)
847 settings_add_bool("lookandfeel", "active_window_ignore_refnum", TRUE);
849 command_bind("window", NULL, (SIGNAL_FUNC) cmd_window);
850 command_bind("window new", NULL, (SIGNAL_FUNC) cmd_window_new);
851 command_bind("window close", NULL, (SIGNAL_FUNC) cmd_window_close);
852 command_bind("window kill", NULL, (SIGNAL_FUNC) cmd_window_close);
853 command_bind("window server", NULL, (SIGNAL_FUNC) cmd_window_server);
854 command_bind("window refnum", NULL, (SIGNAL_FUNC) cmd_window_refnum);
855 command_bind("window goto", NULL, (SIGNAL_FUNC) cmd_window_goto);
856 command_bind("window previous", NULL, (SIGNAL_FUNC) cmd_window_previous);
857 command_bind("window next", NULL, (SIGNAL_FUNC) cmd_window_next);
858 command_bind("window last", NULL, (SIGNAL_FUNC) cmd_window_last);
859 command_bind("window level", NULL, (SIGNAL_FUNC) cmd_window_level);
860 command_bind("window immortal", NULL, (SIGNAL_FUNC) cmd_window_immortal);
861 command_bind("window item", NULL, (SIGNAL_FUNC) cmd_window_item);
862 command_bind("window item prev", NULL, (SIGNAL_FUNC) cmd_window_item_prev);
863 command_bind("window item next", NULL, (SIGNAL_FUNC) cmd_window_item_next);
864 command_bind("window item goto", NULL, (SIGNAL_FUNC) cmd_window_item_goto);
865 command_bind("window item move", NULL, (SIGNAL_FUNC) cmd_window_item_move);
866 command_bind("window number", NULL, (SIGNAL_FUNC) cmd_window_number);
867 command_bind("window name", NULL, (SIGNAL_FUNC) cmd_window_name);
868 command_bind("window history", NULL, (SIGNAL_FUNC) cmd_window_history);
869 command_bind("window move", NULL, (SIGNAL_FUNC) cmd_window_move);
870 command_bind("window move prev", NULL, (SIGNAL_FUNC) cmd_window_move_prev);
871 command_bind("window move next", NULL, (SIGNAL_FUNC) cmd_window_move_next);
872 command_bind("window move first", NULL, (SIGNAL_FUNC) cmd_window_move_first);
873 command_bind("window move last", NULL, (SIGNAL_FUNC) cmd_window_move_last);
874 command_bind("window list", NULL, (SIGNAL_FUNC) cmd_window_list);
875 command_bind("window theme", NULL, (SIGNAL_FUNC) cmd_window_theme);
876 command_bind("layout", NULL, (SIGNAL_FUNC) cmd_layout);
877 /* SYNTAX: LAYOUT SAVE */
878 command_bind("layout save", NULL, (SIGNAL_FUNC) windows_layout_save);
879 /* SYNTAX: LAYOUT RESET */
880 command_bind("layout reset", NULL, (SIGNAL_FUNC) windows_layout_reset);
881 command_bind("foreach window", NULL, (SIGNAL_FUNC) cmd_foreach_window);
883 command_set_options("window number", "sticky");
884 command_set_options("window server", "sticky unsticky");
885 command_set_options("window theme", "delete");
888 void window_commands_deinit(void)
890 command_unbind("window", (SIGNAL_FUNC) cmd_window);
891 command_unbind("window new", (SIGNAL_FUNC) cmd_window_new);
892 command_unbind("window close", (SIGNAL_FUNC) cmd_window_close);
893 command_unbind("window kill", (SIGNAL_FUNC) cmd_window_close);
894 command_unbind("window server", (SIGNAL_FUNC) cmd_window_server);
895 command_unbind("window refnum", (SIGNAL_FUNC) cmd_window_refnum);
896 command_unbind("window goto", (SIGNAL_FUNC) cmd_window_goto);
897 command_unbind("window previous", (SIGNAL_FUNC) cmd_window_previous);
898 command_unbind("window next", (SIGNAL_FUNC) cmd_window_next);
899 command_unbind("window last", (SIGNAL_FUNC) cmd_window_last);
900 command_unbind("window level", (SIGNAL_FUNC) cmd_window_level);
901 command_unbind("window immortal", (SIGNAL_FUNC) cmd_window_immortal);
902 command_unbind("window item", (SIGNAL_FUNC) cmd_window_item);
903 command_unbind("window item prev", (SIGNAL_FUNC) cmd_window_item_prev);
904 command_unbind("window item next", (SIGNAL_FUNC) cmd_window_item_next);
905 command_unbind("window item goto", (SIGNAL_FUNC) cmd_window_item_goto);
906 command_unbind("window item move", (SIGNAL_FUNC) cmd_window_item_move);
907 command_unbind("window number", (SIGNAL_FUNC) cmd_window_number);
908 command_unbind("window name", (SIGNAL_FUNC) cmd_window_name);
909 command_unbind("window history", (SIGNAL_FUNC) cmd_window_history);
910 command_unbind("window move", (SIGNAL_FUNC) cmd_window_move);
911 command_unbind("window move prev", (SIGNAL_FUNC) cmd_window_move_prev);
912 command_unbind("window move next", (SIGNAL_FUNC) cmd_window_move_next);
913 command_unbind("window move first", (SIGNAL_FUNC) cmd_window_move_first);
914 command_unbind("window move last", (SIGNAL_FUNC) cmd_window_move_last);
915 command_unbind("window list", (SIGNAL_FUNC) cmd_window_list);
916 command_unbind("window theme", (SIGNAL_FUNC) cmd_window_theme);
917 command_unbind("layout", (SIGNAL_FUNC) cmd_layout);
918 command_unbind("layout save", (SIGNAL_FUNC) windows_layout_save);
919 command_unbind("layout reset", (SIGNAL_FUNC) windows_layout_reset);
920 command_unbind("foreach window", (SIGNAL_FUNC) cmd_foreach_window);