diff --git a/cmd-list-panes.c b/cmd-list-panes.c index 6a670b29..094ca850 100644 --- a/cmd-list-panes.c +++ b/cmd-list-panes.c @@ -110,22 +110,28 @@ cmd_list_panes_window(struct cmd *self, struct session *s, struct winlink *wl, switch (type) { case 0: template = "#{pane_index}: " - "[#{pane_width}x#{pane_height}] [history " + "[#{pane_width}x#{pane_height}" + "#{?pane_floating_flag, " + "#{pane_x}#,#{pane_y}#,#{pane_z}}] [history " "#{history_size}/#{history_limit}, " "#{history_bytes} bytes] #{pane_id}" "#{?pane_active, (active),}#{?pane_dead, (dead),}"; break; case 1: template = "#{window_index}.#{pane_index}: " - "[#{pane_width}x#{pane_height}] [history " + "[#{pane_width}x#{pane_height}" + "#{?pane_floating_flag, " + "#{pane_x}#,#{pane_y}#,#{pane_z}}] [history " "#{history_size}/#{history_limit}, " "#{history_bytes} bytes] #{pane_id}" "#{?pane_active, (active),}#{?pane_dead, (dead),}"; break; case 2: template = "#{session_name}:#{window_index}." - "#{pane_index}: [#{pane_width}x#{pane_height}] " - "[history #{history_size}/#{history_limit}, " + "#{pane_index}: [#{pane_width}x#{pane_height}" + "#{?pane_floating_flag, " + "#{pane_x}#,#{pane_y}#,#{pane_z}}] [history " + "#{history_size}/#{history_limit}, " "#{history_bytes} bytes] #{pane_id}" "#{?pane_active, (active),}#{?pane_dead, (dead),}"; break; diff --git a/format.c b/format.c index f81d807d..92b1dd3a 100644 --- a/format.c +++ b/format.c @@ -2397,6 +2397,45 @@ format_cb_pane_width(struct format_tree *ft) return (NULL); } +/* Callback for pane_x. */ +static void * +format_cb_pane_x(struct format_tree *ft) +{ + if (ft->wp != NULL) + return (format_printf("%d", ft->wp->xoff)); + return (NULL); +} + +/* Callback for pane_y. */ +static void * +format_cb_pane_y(struct format_tree *ft) +{ + if (ft->wp != NULL) + return (format_printf("%d", ft->wp->yoff)); + return (NULL); +} + +/* Callback for pane_z. */ +static void * +format_cb_pane_z(struct format_tree *ft) +{ + struct window_pane *wp; + u_int n = 0; + + if (ft->wp != NULL) { + if (~ft->wp->flags & PANE_FLOATING) + return (xstrdup("0")); + TAILQ_FOREACH(wp, &ft->wp->window->z_index, zentry) { + if (wp->flags & PANE_FLOATING) + n++; + if (wp == ft->wp) + return (format_printf("%u", n)); + } + return (xstrdup("0")); + } + return (NULL); +} + /* Callback for pane_zoomed_flag. */ static void * format_cb_pane_zoomed_flag(struct format_tree *ft) @@ -3482,6 +3521,15 @@ static const struct format_table_entry format_table[] = { { "pane_width", FORMAT_TABLE_STRING, format_cb_pane_width }, + { "pane_x", FORMAT_TABLE_STRING, + format_cb_pane_x + }, + { "pane_y", FORMAT_TABLE_STRING, + format_cb_pane_y + }, + { "pane_z", FORMAT_TABLE_STRING, + format_cb_pane_z + }, { "pane_zoomed_flag", FORMAT_TABLE_STRING, format_cb_pane_zoomed_flag }, diff --git a/tmux.1 b/tmux.1 index decd945b..aaf811dd 100644 --- a/tmux.1 +++ b/tmux.1 @@ -6569,6 +6569,9 @@ The following variables are available, where appropriate: .It Li "pane_tty" Ta "" Ta "Pseudo terminal of pane" .It Li "pane_unseen_changes" Ta "" Ta "1 if there were changes in pane while in mode" .It Li "pane_width" Ta "" Ta "Width of pane" +.It Li "pane_x" Ta "" Ta "X position of pane" +.It Li "pane_y" Ta "" Ta "Y position of pane" +.It Li "pane_z" Ta "" Ta "Z position of pane" .It Li "pane_zoomed_flag" Ta "" Ta "1 if pane is zoomed" .It Li "pid" Ta "" Ta "Server PID" .It Li "prev_window_active" Ta "" Ta "1 if previous window in W: loop is active"