aboutsummaryrefslogtreecommitdiff
path: root/status.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-08-08 20:36:42 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-08-08 20:36:42 +0000
commit90f8151ffd21f273be62f364ff841f738a10cee0 (patch)
treebdabbe5f8db16f309a827d3a74bbc15c062eb057 /status.c
parent92cc3a691499e3c5cc056bb9bf1a543fc09d32aa (diff)
downloadrtmux-90f8151ffd21f273be62f364ff841f738a10cee0.tar.gz
rtmux-90f8151ffd21f273be62f364ff841f738a10cee0.tar.bz2
rtmux-90f8151ffd21f273be62f364ff841f738a10cee0.zip
Options to set the colours and attributes for status-left/-right. From Thomas
Adam, thanks.
Diffstat (limited to 'status.c')
-rw-r--r--status.c34
1 files changed, 31 insertions, 3 deletions
diff --git a/status.c b/status.c
index 5b625471..47a5d8e4 100644
--- a/status.c
+++ b/status.c
@@ -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. */