summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/cmd-choose-window.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2009-08-04 14:28:24 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2009-08-04 14:28:24 +0000
commite0891d761219b988caf1faccf429ef54f932a8fd (patch)
tree4c551c63a0726087b554ef999abd16ccfd0d51a7 /usr.bin/tmux/cmd-choose-window.c
parentdf6579ea906bb9eb1ede049b15544caf5a8f1896 (diff)
Show the bell/activity/current status and the window title in the choice list.
Diffstat (limited to 'usr.bin/tmux/cmd-choose-window.c')
-rw-r--r--usr.bin/tmux/cmd-choose-window.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/usr.bin/tmux/cmd-choose-window.c b/usr.bin/tmux/cmd-choose-window.c
index ed853d74f0c..486f0830d54 100644
--- a/usr.bin/tmux/cmd-choose-window.c
+++ b/usr.bin/tmux/cmd-choose-window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-choose-window.c,v 1.5 2009/07/26 12:58:44 nicm Exp $ */
+/* $OpenBSD: cmd-choose-window.c,v 1.6 2009/08/04 14:28:23 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -52,6 +52,8 @@ cmd_choose_window_exec(struct cmd *self, struct cmd_ctx *ctx)
struct winlink *wl, *wm;
struct window *w;
u_int idx, cur;
+ char flag, *title;
+ const char *left, *right;
if (ctx->curclient == NULL) {
ctx->error(ctx, "must be run interactively");
@@ -73,9 +75,30 @@ cmd_choose_window_exec(struct cmd *self, struct cmd_ctx *ctx)
cur = idx;
idx++;
+ flag = ' ';
+ if (session_alert_has(s, wm, WINDOW_ACTIVITY))
+ flag = '#';
+ else if (session_alert_has(s, wm, WINDOW_BELL))
+ flag = '!';
+ else if (session_alert_has(s, wm, WINDOW_CONTENT))
+ flag = '+';
+ else if (wm == s->curw)
+ flag = '*';
+ else if (wm == SLIST_FIRST(&s->lastw))
+ flag = '-';
+
+ title = w->active->screen->title;
+ if (wm == wl)
+ title = w->active->base.title;
+ left = " \"";
+ right = "\"";
+ if (*title == '\0')
+ left = right = "";
+
window_choose_add(wl->window->active,
- wm->idx, "%3d: %s [%ux%u] (%u panes)",
- wm->idx, w->name, w->sx, w->sy, window_count_panes(w));
+ wm->idx, "%3d: %s%c [%ux%u] (%u panes)%s%s%s",
+ wm->idx, w->name, flag, w->sx, w->sy, window_count_panes(w),
+ left, title, right);
}
cdata = xmalloc(sizeof *cdata);