From 11cd05db271713b06a3b538f1caf710a3e1b3b4a Mon Sep 17 00:00:00 2001 From: Tiago Cunha Date: Sat, 5 Jun 2010 23:56:29 +0000 Subject: [PATCH] Sync OpenBSD patchset 701: Colour+attribute options for status line alerts, from Alex Alexander. --- cmd-set-option.c | 5 ++++- status.c | 15 ++++++++++++--- tmux.1 | 12 +++++++++++- tmux.c | 5 ++++- 4 files changed, 31 insertions(+), 6 deletions(-) diff --git a/cmd-set-option.c b/cmd-set-option.c index 54216951..577af73e 100644 --- a/cmd-set-option.c +++ b/cmd-set-option.c @@ -1,4 +1,4 @@ -/* $Id: cmd-set-option.c,v 1.96 2010-02-26 13:31:39 tcunha Exp $ */ +/* $Id: cmd-set-option.c,v 1.97 2010-06-05 23:56:29 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -157,6 +157,9 @@ const struct set_option_entry set_window_option_table[] = { { "remain-on-exit", SET_OPTION_FLAG, 0, 0, NULL }, { "synchronize-panes", SET_OPTION_FLAG, 0, 0, NULL }, { "utf8", SET_OPTION_FLAG, 0, 0, NULL }, + { "window-status-alert-attr", SET_OPTION_ATTRIBUTES, 0, 0, NULL }, + { "window-status-alert-bg", SET_OPTION_COLOUR, 0, 0, NULL }, + { "window-status-alert-fg", SET_OPTION_COLOUR, 0, 0, NULL }, { "window-status-attr", SET_OPTION_ATTRIBUTES, 0, 0, NULL }, { "window-status-bg", SET_OPTION_COLOUR, 0, 0, NULL }, { "window-status-current-attr", SET_OPTION_ATTRIBUTES, 0, 0, NULL }, diff --git a/status.c b/status.c index 6169178e..d8b529ef 100644 --- a/status.c +++ b/status.c @@ -1,4 +1,4 @@ -/* $Id: status.c,v 1.147 2010-04-06 21:45:36 nicm Exp $ */ +/* $Id: status.c,v 1.148 2010-06-05 23:56:29 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -595,8 +595,17 @@ status_print( if (session_alert_has(s, wl, WINDOW_ACTIVITY) || session_alert_has(s, wl, WINDOW_BELL) || - session_alert_has(s, wl, WINDOW_CONTENT)) - gc->attr ^= GRID_ATTR_REVERSE; + session_alert_has(s, wl, WINDOW_CONTENT)) { + fg = options_get_number(oo, "window-status-alert-fg"); + if (fg != 8) + colour_set_fg(gc, fg); + bg = options_get_number(oo, "window-status-alert-bg"); + if (bg != 8) + colour_set_bg(gc, bg); + attr = options_get_number(oo, "window-status-alert-attr"); + if (attr != 0) + gc->attr = attr; + } text = status_replace(c, wl, fmt, t, 1); return (text); diff --git a/tmux.1 b/tmux.1 index ac19c8f8..c42e577c 100644 --- a/tmux.1 +++ b/tmux.1 @@ -1,4 +1,4 @@ -.\" $Id: tmux.1,v 1.250 2010-06-05 23:54:51 tcunha Exp $ +.\" $Id: tmux.1,v 1.251 2010-06-05 23:56:29 tcunha Exp $ .\" .\" Copyright (c) 2007 Nicholas Marriott .\" @@ -2073,6 +2073,16 @@ option for details of special character sequences available. The default is .Ql #I:#W#F . .Pp +.It Ic window-status-alert-attr Ar attributes +Set status line attributes for windows which have an alert (bell, activity +or content). +.Pp +.It Ic window-status-alert-bg Ar colour +Set status line background colour for windows with an alert. +.Pp +.It Ic window-status-alert-fg Ar colour +Set status line foreground colour for windows with an alert. +.Pp .It Ic window-status-current-attr Ar attributes Set status line attributes for the currently active window. .Pp diff --git a/tmux.c b/tmux.c index 6a4e11d7..f86eca78 100644 --- a/tmux.c +++ b/tmux.c @@ -1,4 +1,4 @@ -/* $Id: tmux.c,v 1.208 2010-05-16 17:50:31 nicm Exp $ */ +/* $Id: tmux.c,v 1.209 2010-06-05 23:56:29 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -419,6 +419,9 @@ main(int argc, char **argv) options_set_number(wo, "window-status-current-bg", 8); options_set_number(wo, "window-status-current-fg", 8); options_set_number(wo, "window-status-fg", 8); + options_set_number(wo, "window-status-alert-attr", GRID_ATTR_REVERSE); + options_set_number(wo, "window-status-alert-bg", 8); + options_set_number(wo, "window-status-alert-fg", 8); options_set_string(wo, "window-status-format", "#I:#W#F"); options_set_string(wo, "window-status-current-format", "#I:#W#F"); options_set_string(wo, "word-separators", " -_@");