version 1.39, 2016/10/14 22:14:22 |
version 1.40, 2016/10/16 19:04:05 |
|
|
"(#{window_panes} panes) " \ |
"(#{window_panes} panes) " \ |
"[#{window_width}x#{window_height}] " |
"[#{window_width}x#{window_height}] " |
|
|
static enum cmd_retval cmd_list_windows_exec(struct cmd *, struct cmd_q *); |
static enum cmd_retval cmd_list_windows_exec(struct cmd *, struct cmdq_item *); |
|
|
static void cmd_list_windows_server(struct cmd *, struct cmd_q *); |
static void cmd_list_windows_server(struct cmd *, struct cmdq_item *); |
static void cmd_list_windows_session(struct cmd *, struct session *, |
static void cmd_list_windows_session(struct cmd *, struct session *, |
struct cmd_q *, int); |
struct cmdq_item *, int); |
|
|
const struct cmd_entry cmd_list_windows_entry = { |
const struct cmd_entry cmd_list_windows_entry = { |
.name = "list-windows", |
.name = "list-windows", |
|
|
}; |
}; |
|
|
static enum cmd_retval |
static enum cmd_retval |
cmd_list_windows_exec(struct cmd *self, struct cmd_q *cmdq) |
cmd_list_windows_exec(struct cmd *self, struct cmdq_item *item) |
{ |
{ |
struct args *args = self->args; |
struct args *args = self->args; |
|
|
if (args_has(args, 'a')) |
if (args_has(args, 'a')) |
cmd_list_windows_server(self, cmdq); |
cmd_list_windows_server(self, item); |
else |
else |
cmd_list_windows_session(self, cmdq->state.tflag.s, cmdq, 0); |
cmd_list_windows_session(self, item->state.tflag.s, item, 0); |
|
|
return (CMD_RETURN_NORMAL); |
return (CMD_RETURN_NORMAL); |
} |
} |
|
|
static void |
static void |
cmd_list_windows_server(struct cmd *self, struct cmd_q *cmdq) |
cmd_list_windows_server(struct cmd *self, struct cmdq_item *item) |
{ |
{ |
struct session *s; |
struct session *s; |
|
|
RB_FOREACH(s, sessions, &sessions) |
RB_FOREACH(s, sessions, &sessions) |
cmd_list_windows_session(self, s, cmdq, 1); |
cmd_list_windows_session(self, s, item, 1); |
} |
} |
|
|
static void |
static void |
cmd_list_windows_session(struct cmd *self, struct session *s, |
cmd_list_windows_session(struct cmd *self, struct session *s, |
struct cmd_q *cmdq, int type) |
struct cmdq_item *item, int type) |
{ |
{ |
struct args *args = self->args; |
struct args *args = self->args; |
struct winlink *wl; |
struct winlink *wl; |
|
|
|
|
n = 0; |
n = 0; |
RB_FOREACH(wl, winlinks, &s->windows) { |
RB_FOREACH(wl, winlinks, &s->windows) { |
ft = format_create(cmdq, 0); |
ft = format_create(item, 0); |
format_add(ft, "line", "%u", n); |
format_add(ft, "line", "%u", n); |
format_defaults(ft, NULL, s, wl, NULL); |
format_defaults(ft, NULL, s, wl, NULL); |
|
|
line = format_expand(ft, template); |
line = format_expand(ft, template); |
cmdq_print(cmdq, "%s", line); |
cmdq_print(item, "%s", line); |
free(line); |
free(line); |
|
|
format_free(ft); |
format_free(ft); |