mirror of
https://github.com/tmux/tmux.git
synced 2024-12-24 10:08:48 +00:00
Add formats for when window is larger than client, and show offset in
status-right by default when larger.
This commit is contained in:
parent
b74b047730
commit
ebaf54251a
18
format.c
18
format.c
@ -106,9 +106,10 @@ struct format_entry {
|
||||
|
||||
/* Format entry tree. */
|
||||
struct format_tree {
|
||||
struct window *w;
|
||||
struct winlink *wl;
|
||||
struct client *c;
|
||||
struct session *s;
|
||||
struct winlink *wl;
|
||||
struct window *w;
|
||||
struct window_pane *wp;
|
||||
|
||||
struct client *client;
|
||||
@ -1395,6 +1396,7 @@ format_defaults_client(struct format_tree *ft, struct client *c)
|
||||
|
||||
if (ft->s == NULL)
|
||||
ft->s = c->session;
|
||||
ft->c = c;
|
||||
|
||||
format_add(ft, "client_name", "%s", c->name);
|
||||
format_add(ft, "client_pid", "%ld", (long) c->pid);
|
||||
@ -1463,8 +1465,11 @@ format_defaults_window(struct format_tree *ft, struct window *w)
|
||||
static void
|
||||
format_defaults_winlink(struct format_tree *ft, struct winlink *wl)
|
||||
{
|
||||
struct client *c = ft->c;
|
||||
struct session *s = wl->session;
|
||||
struct window *w = wl->window;
|
||||
int flag;
|
||||
u_int ox, oy, sx, sy;
|
||||
|
||||
if (ft->w == NULL)
|
||||
ft->w = wl->window;
|
||||
@ -1472,6 +1477,15 @@ format_defaults_winlink(struct format_tree *ft, struct winlink *wl)
|
||||
|
||||
format_defaults_window(ft, w);
|
||||
|
||||
if (c != NULL) {
|
||||
flag = tty_window_offset(&c->tty, &ox, &oy, &sx, &sy);
|
||||
format_add(ft, "window_bigger", "%d", flag);
|
||||
if (flag) {
|
||||
format_add(ft, "window_offset_x", "%u", ox);
|
||||
format_add(ft, "window_offset_y", "%u", oy);
|
||||
}
|
||||
}
|
||||
|
||||
format_add(ft, "window_index", "%d", wl->idx);
|
||||
format_add_cb(ft, "window_stack_index", format_cb_window_stack_index);
|
||||
format_add(ft, "window_flags", "%s", window_printable_flags(wl));
|
||||
|
@ -476,7 +476,9 @@ const struct options_table_entry options_table[] = {
|
||||
{ .name = "status-right",
|
||||
.type = OPTIONS_TABLE_STRING,
|
||||
.scope = OPTIONS_TABLE_SESSION,
|
||||
.default_str = " \"#{=21:pane_title}\" %H:%M %d-%b-%y"
|
||||
.default_str = "#{?window_bigger,"
|
||||
"[#{window_offset_x}#,#{window_offset_y}] ,}"
|
||||
"\"#{=21:pane_title}\" %H:%M %d-%b-%y"
|
||||
},
|
||||
|
||||
{ .name = "status-right-attr",
|
||||
|
3
tmux.1
3
tmux.1
@ -3921,6 +3921,7 @@ The following variables are available, where appropriate:
|
||||
.It Li "window_activity_flag" Ta "" Ta "1 if window has activity"
|
||||
.It Li "window_active" Ta "" Ta "1 if window active"
|
||||
.It Li "window_bell_flag" Ta "" Ta "1 if window has bell"
|
||||
.It Li "window_bigger" Ta "" Ta "1 if window is larger than client"
|
||||
.It Li "window_flags" Ta "#F" Ta "Window flags"
|
||||
.It Li "window_format" Ta "" Ta "1 if format is for a window (not assuming the current)"
|
||||
.It Li "window_height" Ta "" Ta "Height of window"
|
||||
@ -3930,6 +3931,8 @@ The following variables are available, where appropriate:
|
||||
.It Li "window_layout" Ta "" Ta "Window layout description, ignoring zoomed window panes"
|
||||
.It Li "window_linked" Ta "" Ta "1 if window is linked across sessions"
|
||||
.It Li "window_name" Ta "#W" Ta "Name of window"
|
||||
.It Li "window_offset_x" Ta "" Ta "X offset into window if larger than client"
|
||||
.It Li "window_offset_y" Ta "" Ta "Y offset into window if larger than client"
|
||||
.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_stack_index" Ta "" Ta "Index in session most recent stack"
|
||||
|
Loading…
Reference in New Issue
Block a user