Colour+attribute options for status line alerts, from Alex Alexander.

This commit is contained in:
Nicholas Marriott 2010-05-14 19:03:09 +00:00
parent 4af4d12475
commit d91127958d
4 changed files with 27 additions and 2 deletions

View File

@ -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 },

View File

@ -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);

10
tmux.1
View File

@ -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

3
tmux.c
View File

@ -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", " -_@");