summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/tmux/cmd-set-option.c8
-rw-r--r--usr.bin/tmux/status.c36
-rw-r--r--usr.bin/tmux/tmux.116
-rw-r--r--usr.bin/tmux/tmux.c12
4 files changed, 62 insertions, 10 deletions
diff --git a/usr.bin/tmux/cmd-set-option.c b/usr.bin/tmux/cmd-set-option.c
index e1762dfc539..b0e52c39b56 100644
--- a/usr.bin/tmux/cmd-set-option.c
+++ b/usr.bin/tmux/cmd-set-option.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-set-option.c,v 1.11 2009/08/04 18:45:57 nicm Exp $ */
+/* $OpenBSD: cmd-set-option.c,v 1.12 2009/08/08 20:36:42 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -74,8 +74,14 @@ const struct set_option_entry set_option_table[] = {
SET_OPTION_CHOICE, 0, 0, set_option_status_justify_list },
{ "status-keys", SET_OPTION_CHOICE, 0, 0, set_option_status_keys_list },
{ "status-left", SET_OPTION_STRING, 0, 0, NULL },
+ { "status-left-attr", SET_OPTION_ATTRIBUTES, 0, 0, NULL },
+ { "status-left-bg", SET_OPTION_COLOUR, 0, 0, NULL },
+ { "status-left-fg", SET_OPTION_COLOUR, 0, 0, NULL },
{ "status-left-length", SET_OPTION_NUMBER, 0, SHRT_MAX, NULL },
{ "status-right", SET_OPTION_STRING, 0, 0, NULL },
+ { "status-right-attr", SET_OPTION_ATTRIBUTES, 0, 0, NULL },
+ { "status-right-bg", SET_OPTION_COLOUR, 0, 0, NULL },
+ { "status-right-fg", SET_OPTION_COLOUR, 0, 0, NULL },
{ "status-right-length", SET_OPTION_NUMBER, 0, SHRT_MAX, NULL },
{ "status-utf8", SET_OPTION_FLAG, 0, 0, NULL },
{ "terminal-overrides", SET_OPTION_STRING, 0, 0, NULL },
diff --git a/usr.bin/tmux/status.c b/usr.bin/tmux/status.c
index edb74dc8134..b36ad27f96b 100644
--- a/usr.bin/tmux/status.c
+++ b/usr.bin/tmux/status.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: status.c,v 1.23 2009/08/05 16:26:38 nicm Exp $ */
+/* $OpenBSD: status.c,v 1.24 2009/08/08 20:36:42 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -47,8 +47,10 @@ status_redraw(struct client *c)
char *left, *right, *text, *ptr;
size_t llen, llen2, rlen, rlen2, offset;
size_t ox, xx, yy, size, start, width;
- struct grid_cell stdgc, gc;
+ struct grid_cell stdgc, sl_stdgc, sr_stdgc, gc;
int larrow, rarrow, utf8flag;
+ int sl_fg, sl_bg, sr_fg, sr_bg;
+ int sl_attr, sr_attr;
left = right = NULL;
@@ -68,6 +70,32 @@ status_redraw(struct client *c)
stdgc.bg = options_get_number(&s->options, "status-bg");
stdgc.attr |= options_get_number(&s->options, "status-attr");
+ /*
+ * Set the status-left and status-right parts to the default status
+ * line options and only change them where they differ from the
+ * defaults.
+ */
+ memcpy(&sl_stdgc, &stdgc, sizeof sl_stdgc);
+ memcpy(&sr_stdgc, &stdgc, sizeof sr_stdgc);
+ sl_fg = options_get_number(&s->options, "status-left-fg");
+ if (sl_fg != 8)
+ sl_stdgc.fg = sl_fg;
+ sl_bg = options_get_number(&s->options, "status-left-bg");
+ if (sl_bg != 8)
+ sl_stdgc.bg = sl_bg;
+ sl_attr = options_get_number(&s->options, "status-left-attr");
+ if (sl_attr != 0)
+ sl_stdgc.attr = sl_attr;
+ sr_fg = options_get_number(&s->options, "status-right-fg");
+ if (sr_fg != 8)
+ sr_stdgc.fg = sr_fg;
+ sr_bg = options_get_number(&s->options, "status-right-bg");
+ if (sr_bg != 8)
+ sr_stdgc.bg = sr_bg;
+ sr_attr = options_get_number(&s->options, "status-right-attr");
+ if (sr_attr != 0)
+ sr_stdgc.attr = sr_attr;
+
yy = c->tty.sy - 1;
if (yy == 0)
goto blank;
@@ -164,7 +192,7 @@ draw:
screen_write_start(&ctx, NULL, &c->status);
if (llen != 0) {
screen_write_cursormove(&ctx, 0, yy);
- screen_write_nputs(&ctx, llen, &stdgc, utf8flag, "%s", left);
+ screen_write_nputs(&ctx, llen, &sl_stdgc, utf8flag, "%s", left);
screen_write_putc(&ctx, &stdgc, ' ');
if (larrow)
screen_write_putc(&ctx, &stdgc, ' ');
@@ -238,7 +266,7 @@ draw:
if (rlen != 0) {
screen_write_cursormove(&ctx, c->tty.sx - rlen - 1, yy);
screen_write_putc(&ctx, &stdgc, ' ');
- screen_write_nputs(&ctx, rlen, &stdgc, utf8flag, "%s", right);
+ screen_write_nputs(&ctx, rlen, &sr_stdgc, utf8flag, "%s", right);
}
/* Draw the arrows. */
diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1
index a531c21554c..c7d341af824 100644
--- a/usr.bin/tmux/tmux.1
+++ b/usr.bin/tmux/tmux.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: tmux.1,v 1.61 2009/08/07 15:39:10 nicm Exp $
+.\" $OpenBSD: tmux.1,v 1.62 2009/08/08 20:36:42 nicm Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
.\"
@@ -14,7 +14,7 @@
.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: August 7 2009 $
+.Dd $Mdocdate: August 8 2009 $
.Dt TMUX 1
.Os
.Sh NAME
@@ -1238,6 +1238,12 @@ By default, UTF-8 in
is not interpreted, to enable UTF-8, use the
.Ic status-utf8
option.
+.It Ic status-left-attr Ar attributes
+Set the attribute of the left part of the status line.
+.It Ic status-left-fg Ar colour
+Set the foreground colour of the left part of the status line.
+.It Ic status-left-bg Ar colour
+Set the background colour of the left part of the status line.
.It Ic status-left-length Ar length
Set the maximum
.Ar length
@@ -1256,6 +1262,12 @@ will be passed to
character pairs are replaced, and UTF-8 is dependent on the
.Ic status-utf8
option.
+.It Ic status-right-attr Ar attributes
+Set the attribute of the right part of the status line.
+.It Ic status-right-fg Ar colour
+Set the foreground colour of the right part of the status line.
+.It Ic status-right-bg Ar colour
+Set the background colour of the right part of the status line.
.It Ic status-right-length Ar length
Set the maximum
.Ar length
diff --git a/usr.bin/tmux/tmux.c b/usr.bin/tmux/tmux.c
index 0c85a59f9be..6959b4662f0 100644
--- a/usr.bin/tmux/tmux.c
+++ b/usr.bin/tmux/tmux.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.c,v 1.27 2009/08/05 16:26:38 nicm Exp $ */
+/* $OpenBSD: tmux.c,v 1.28 2009/08/08 20:36:42 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -359,11 +359,17 @@ main(int argc, char **argv)
options_set_number(&global_s_options, "status-interval", 15);
options_set_number(&global_s_options, "status-keys", MODEKEY_EMACS);
options_set_number(&global_s_options, "status-justify", 0);
- options_set_number(&global_s_options, "status-left-length", 10);
- options_set_number(&global_s_options, "status-right-length", 40);
options_set_string(&global_s_options, "status-left", "[#S]");
+ options_set_number(&global_s_options, "status-left-attr", 0);
+ options_set_number(&global_s_options, "status-left-fg", 8);
+ options_set_number(&global_s_options, "status-left-bg", 8);
+ options_set_number(&global_s_options, "status-left-length", 10);
options_set_string(
&global_s_options, "status-right", "\"#22T\" %%H:%%M %%d-%%b-%%y");
+ options_set_number(&global_s_options, "status-right-attr", 0);
+ options_set_number(&global_s_options, "status-right-fg", 8);
+ options_set_number(&global_s_options, "status-right-bg", 8);
+ options_set_number(&global_s_options, "status-right-length", 40);
if (flags & IDENTIFY_UTF8)
options_set_number(&global_s_options, "status-utf8", 1);
else