From d91127958d2936fdae28d695d85c15d2bca0d9cf Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Fri, 14 May 2010 19:03:09 +0000 Subject: [PATCH] Colour+attribute options for status line alerts, from Alex Alexander. --- cmd-set-option.c | 3 +++ status.c | 13 +++++++++++-- tmux.1 | 10 ++++++++++ tmux.c | 3 +++ 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/cmd-set-option.c b/cmd-set-option.c index 90b6d611..85776fbb 100644 --- a/cmd-set-option.c +++ b/cmd-set-option.c @@ -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 b3ae78ce..4399ae43 100644 --- a/status.c +++ b/status.c @@ -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 85aabdb7..132a58ea 100644 --- a/tmux.1 +++ b/tmux.1 @@ -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 2b0dd63c..28f822ce 100644 --- a/tmux.c +++ b/tmux.c @@ -416,6 +416,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", " -_@");