mirror of
https://github.com/tmux/tmux.git
synced 2025-01-07 16:28:48 +00:00
Add formats for window flags.
This commit is contained in:
parent
6e665708fc
commit
d75dd2ab1c
24
format.c
24
format.c
@ -151,6 +151,7 @@ void
|
|||||||
format_add(struct format_tree *ft, const char *key, const char *fmt, ...)
|
format_add(struct format_tree *ft, const char *key, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
struct format_entry *fe;
|
struct format_entry *fe;
|
||||||
|
struct format_entry *fe_now;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
fe = xmalloc(sizeof *fe);
|
fe = xmalloc(sizeof *fe);
|
||||||
@ -160,7 +161,13 @@ format_add(struct format_tree *ft, const char *key, const char *fmt, ...)
|
|||||||
xvasprintf(&fe->value, fmt, ap);
|
xvasprintf(&fe->value, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
RB_INSERT(format_tree, ft, fe);
|
fe_now = RB_INSERT(format_tree, ft, fe);
|
||||||
|
if (fe_now != NULL) {
|
||||||
|
free(fe_now->value);
|
||||||
|
fe_now->value = fe->value;
|
||||||
|
free(fe->key);
|
||||||
|
free(fe);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find a format entry. */
|
/* Find a format entry. */
|
||||||
@ -346,8 +353,10 @@ format_client(struct format_tree *ft, struct client *c)
|
|||||||
format_add(ft, "client_cwd", "%s", c->cwd);
|
format_add(ft, "client_cwd", "%s", c->cwd);
|
||||||
format_add(ft, "client_height", "%u", c->tty.sy);
|
format_add(ft, "client_height", "%u", c->tty.sy);
|
||||||
format_add(ft, "client_width", "%u", c->tty.sx);
|
format_add(ft, "client_width", "%u", c->tty.sx);
|
||||||
format_add(ft, "client_tty", "%s", c->tty.path);
|
if (c->tty.path != NULL)
|
||||||
format_add(ft, "client_termname", "%s", c->tty.termname);
|
format_add(ft, "client_tty", "%s", c->tty.path);
|
||||||
|
if (c->tty.termname != NULL)
|
||||||
|
format_add(ft, "client_termname", "%s", c->tty.termname);
|
||||||
|
|
||||||
t = c->creation_time.tv_sec;
|
t = c->creation_time.tv_sec;
|
||||||
format_add(ft, "client_created", "%lld", (long long) t);
|
format_add(ft, "client_created", "%lld", (long long) t);
|
||||||
@ -401,6 +410,15 @@ format_winlink(struct format_tree *ft, struct session *s, struct winlink *wl)
|
|||||||
format_add(ft, "window_active", "%d", wl == s->curw);
|
format_add(ft, "window_active", "%d", wl == s->curw);
|
||||||
format_add(ft, "window_panes", "%u", window_count_panes(w));
|
format_add(ft, "window_panes", "%u", window_count_panes(w));
|
||||||
|
|
||||||
|
format_add(ft, "window_bell_flag", "%u",
|
||||||
|
!!(wl->flags & WINLINK_BELL));
|
||||||
|
format_add(ft, "window_content_flag", "%u",
|
||||||
|
!!(wl->flags & WINLINK_CONTENT));
|
||||||
|
format_add(ft, "window_activity_flag", "%u",
|
||||||
|
!!(wl->flags & WINLINK_ACTIVITY));
|
||||||
|
format_add(ft, "window_silence_flag", "%u",
|
||||||
|
!!(wl->flags & WINLINK_SILENCE));
|
||||||
|
|
||||||
free(flags);
|
free(flags);
|
||||||
free(layout);
|
free(layout);
|
||||||
}
|
}
|
||||||
|
4
tmux.1
4
tmux.1
@ -3094,6 +3094,9 @@ The following variables are available, where appropriate:
|
|||||||
.It Li "session_width" Ta "" Ta "Width of session"
|
.It Li "session_width" Ta "" Ta "Width of session"
|
||||||
.It Li "session_windows" Ta "" Ta "Number of windows in session"
|
.It Li "session_windows" Ta "" Ta "Number of windows in session"
|
||||||
.It Li "window_active" Ta "" Ta "1 if window active"
|
.It Li "window_active" Ta "" Ta "1 if window active"
|
||||||
|
.It Li "window_activity_flag" Ta "" Ta "1 if window has activity alert"
|
||||||
|
.It Li "window_bell_flag" Ta "" Ta "1 if window has bell"
|
||||||
|
.It Li "window_content_flag" Ta "" Ta "1 if window has content alert"
|
||||||
.It Li "window_find_matches" Ta "" Ta "Matched data from the find-window"
|
.It Li "window_find_matches" Ta "" Ta "Matched data from the find-window"
|
||||||
.It Li "window_flags" Ta "#F" Ta "Window flags"
|
.It Li "window_flags" Ta "#F" Ta "Window flags"
|
||||||
.It Li "window_height" Ta "" Ta "Height of window"
|
.It Li "window_height" Ta "" Ta "Height of window"
|
||||||
@ -3102,6 +3105,7 @@ The following variables are available, where appropriate:
|
|||||||
.It Li "window_layout" Ta "" Ta "Window layout description"
|
.It Li "window_layout" Ta "" Ta "Window layout description"
|
||||||
.It Li "window_name" Ta "#W" Ta "Name of window"
|
.It Li "window_name" Ta "#W" Ta "Name of window"
|
||||||
.It Li "window_panes" Ta "" Ta "Number of panes in window"
|
.It Li "window_panes" Ta "" Ta "Number of panes in window"
|
||||||
|
.It Li "window_silence_flag" Ta "" Ta "1 if window has silence alert"
|
||||||
.It Li "window_width" Ta "" Ta "Width of window"
|
.It Li "window_width" Ta "" Ta "Width of window"
|
||||||
.It Li "wrap_flag" Ta "" Ta "Pane wrap flag"
|
.It Li "wrap_flag" Ta "" Ta "Pane wrap flag"
|
||||||
.El
|
.El
|
||||||
|
Loading…
Reference in New Issue
Block a user