aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--format.c20
-rw-r--r--options-table.c2
-rw-r--r--tmux.11
3 files changed, 22 insertions, 1 deletions
diff --git a/format.c b/format.c
index 39351fc3..db6f9231 100644
--- a/format.c
+++ b/format.c
@@ -494,6 +494,8 @@ format_defaults_session(struct format_tree *ft, struct session *s)
{
struct session_group *sg;
time_t t;
+ struct winlink *wl;
+ char alerts[256], tmp[16];
ft->s = s;
@@ -518,6 +520,24 @@ format_defaults_session(struct format_tree *ft, struct session *s)
format_add(ft, "session_attached", "%u", s->attached);
format_add(ft, "session_many_attached", "%d", s->attached > 1);
+
+ *alerts = '\0';
+ RB_FOREACH (wl, winlinks, &s->windows) {
+ if ((wl->flags & WINLINK_ALERTFLAGS) == 0)
+ continue;
+ snprintf(tmp, sizeof tmp, "%u", wl->idx);
+
+ if (*alerts != '\0')
+ strlcat(alerts, ",", sizeof alerts);
+ strlcat(alerts, tmp, sizeof alerts);
+ if (wl->flags & WINLINK_ACTIVITY)
+ strlcat(alerts, "#", sizeof alerts);
+ if (wl->flags & WINLINK_BELL)
+ strlcat(alerts, "!", sizeof alerts);
+ if (wl->flags & WINLINK_SILENCE)
+ strlcat(alerts, "~", sizeof alerts);
+ }
+ format_add(ft, "session_alerts", "%s", alerts);
}
/* Set default format keys for a client. */
diff --git a/options-table.c b/options-table.c
index 44d36dca..4ad45d37 100644
--- a/options-table.c
+++ b/options-table.c
@@ -296,7 +296,7 @@ const struct options_table_entry session_options_table[] = {
{ .name = "set-titles-string",
.type = OPTIONS_TABLE_STRING,
- .default_str = "#S:#I:#W - \"#T\""
+ .default_str = "#S:#I:#W - \"#T\" #{session_alerts}"
},
{ .name = "status",
diff --git a/tmux.1 b/tmux.1
index 7d9c0dc8..f5a0aaa3 100644
--- a/tmux.1
+++ b/tmux.1
@@ -3304,6 +3304,7 @@ The following variables are available, where appropriate:
.It Li "pane_width" Ta "" Ta "Width of pane"
.It Li "scroll_region_lower" Ta "" Ta "Bottom of scroll region in pane"
.It Li "scroll_region_upper" Ta "" Ta "Top of scroll region in pane"
+.It Li "session_alerts" Ta "" Ta "List of window indexes with alerts"
.It Li "session_attached" Ta "" Ta "Number of clients session is attached to"
.It Li "session_activity" Ta "" Ta "Integer time of session last activity"
.It Li "session_activity_string" Ta "" Ta "String time of session last activity"