mirror of
https://github.com/tmux/tmux.git
synced 2024-12-13 01:48:47 +00:00
Merge branch 'obsd-master'
This commit is contained in:
commit
e2917b2627
@ -19,6 +19,8 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "tmux.h"
|
||||
|
||||
#define CONTROL_SHOULD_NOTIFY_CLIENT(c) \
|
||||
@ -65,6 +67,10 @@ control_notify_window_layout_changed(struct window *w)
|
||||
struct format_tree *ft;
|
||||
struct winlink *wl;
|
||||
const char *template;
|
||||
char *expanded;
|
||||
|
||||
template = "%layout-change #{window_id} #{window_layout} "
|
||||
"#{window_visible_layout} #{window_flags}";
|
||||
|
||||
TAILQ_FOREACH(c, &clients, entry) {
|
||||
if (!CONTROL_SHOULD_NOTIFY_CLIENT(c) || c->session == NULL)
|
||||
@ -81,13 +87,14 @@ control_notify_window_layout_changed(struct window *w)
|
||||
*/
|
||||
if (w->layout_root == NULL)
|
||||
continue;
|
||||
template = "%layout-change #{window_id} #{window_layout}";
|
||||
|
||||
ft = format_create();
|
||||
wl = winlink_find_by_window(&s->windows, w);
|
||||
if (wl != NULL) {
|
||||
format_defaults(ft, c, NULL, wl, NULL);
|
||||
control_write(c, "%s", format_expand(ft, template));
|
||||
expanded = format_expand(ft, template);
|
||||
control_write(c, "%s", expanded);
|
||||
free(expanded);
|
||||
}
|
||||
format_free(ft);
|
||||
}
|
||||
|
15
format.c
15
format.c
@ -49,6 +49,7 @@ void format_cb_host_short(struct format_tree *, struct format_entry *);
|
||||
void format_cb_pid(struct format_tree *, struct format_entry *);
|
||||
void format_cb_session_alerts(struct format_tree *, struct format_entry *);
|
||||
void format_cb_window_layout(struct format_tree *, struct format_entry *);
|
||||
void format_cb_window_visible_layout(struct format_tree *, struct format_entry *);
|
||||
void format_cb_start_command(struct format_tree *, struct format_entry *);
|
||||
void format_cb_current_command(struct format_tree *, struct format_entry *);
|
||||
void format_cb_current_path(struct format_tree *, struct format_entry *);
|
||||
@ -364,6 +365,18 @@ format_cb_window_layout(struct format_tree *ft, struct format_entry *fe)
|
||||
fe->value = layout_dump(w->layout_root);
|
||||
}
|
||||
|
||||
/* Callback for window_visible_layout. */
|
||||
void
|
||||
format_cb_window_visible_layout(struct format_tree *ft, struct format_entry *fe)
|
||||
{
|
||||
struct window *w = ft->w;
|
||||
|
||||
if (w == NULL)
|
||||
return;
|
||||
|
||||
fe->value = layout_dump(w->layout_root);
|
||||
}
|
||||
|
||||
/* Callback for pane_start_command. */
|
||||
void
|
||||
format_cb_start_command(struct format_tree *ft, struct format_entry *fe)
|
||||
@ -1041,6 +1054,8 @@ format_defaults_window(struct format_tree *ft, struct window *w)
|
||||
format_add(ft, "window_width", "%u", w->sx);
|
||||
format_add(ft, "window_height", "%u", w->sy);
|
||||
format_add_cb(ft, "window_layout", format_cb_window_layout);
|
||||
format_add_cb(ft, "window_visible_layout",
|
||||
format_cb_window_visible_layout);
|
||||
format_add(ft, "window_panes", "%u", window_count_panes(w));
|
||||
format_add(ft, "window_zoomed_flag", "%d",
|
||||
!!(w->flags & WINDOW_ZOOMED));
|
||||
|
9
tmux.1
9
tmux.1
@ -3417,11 +3417,12 @@ The following variables are available, where appropriate:
|
||||
.It Li "window_id" Ta "" Ta "Unique window ID"
|
||||
.It Li "window_index" Ta "#I" Ta "Index of window"
|
||||
.It Li "window_last_flag" Ta "" Ta "1 if window is the last used"
|
||||
.It Li "window_layout" Ta "" Ta "Window layout description"
|
||||
.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_panes" Ta "" Ta "Number of panes in window"
|
||||
.It Li "window_silence_flag" Ta "" Ta "1 if window has silence alert"
|
||||
.It Li "window_visible_layout" Ta "" Ta "Window layout description, respecting zoomed window panes"
|
||||
.It Li "window_width" Ta "" Ta "Width of window"
|
||||
.It Li "window_zoomed_flag" Ta "" Ta "1 if window is zoomed"
|
||||
.It Li "wrap_flag" Ta "" Ta "Pane wrap flag"
|
||||
@ -4012,12 +4013,16 @@ or an error occurred.
|
||||
If present,
|
||||
.Ar reason
|
||||
describes why the client exited.
|
||||
.It Ic %layout-change Ar window-id Ar window-layout
|
||||
.It Ic %layout-change Ar window-id Ar window-layout Ar window-visible-layout Ar window-flags
|
||||
The layout of a window with ID
|
||||
.Ar window-id
|
||||
changed.
|
||||
The new layout is
|
||||
.Ar window-layout .
|
||||
The window's visible layout is
|
||||
.Ar window-visible-layout
|
||||
and the window flags are
|
||||
.Ar window-flags .
|
||||
.It Ic %output Ar pane-id Ar value
|
||||
A window pane produced output.
|
||||
.Ar value
|
||||
|
Loading…
Reference in New Issue
Block a user