diff options
author | nicm <nicm> | 2022-02-22 11:10:41 +0000 |
---|---|---|
committer | nicm <nicm> | 2022-02-22 11:10:41 +0000 |
commit | fa71e9a07911715da596d618fe045943337c596b (patch) | |
tree | cd33824c0c9a11b12a6f378c8f64cb1929384d8d | |
parent | 0fd01f8873ccae655b0f997ca0dc46c42ebe399d (diff) | |
download | rtmux-fa71e9a07911715da596d618fe045943337c596b.tar.gz rtmux-fa71e9a07911715da596d618fe045943337c596b.tar.bz2 rtmux-fa71e9a07911715da596d618fe045943337c596b.zip |
Add next_session_id format with the next session ID, GitHub issue 3078.
-rw-r--r-- | format.c | 10 | ||||
-rw-r--r-- | session.c | 2 | ||||
-rw-r--r-- | tmux.1 | 6 | ||||
-rw-r--r-- | tmux.h | 1 |
4 files changed, 18 insertions, 1 deletions
@@ -1650,6 +1650,13 @@ format_cb_mouse_y(struct format_tree *ft) return (NULL); } +/* Callback for next_session_id. */ +static void * +format_cb_next_session_id(__unused struct format_tree *ft) +{ + return (format_printf("$%u", next_session_id)); +} + /* Callback for origin_flag. */ static void * format_cb_origin_flag(struct format_tree *ft) @@ -2707,6 +2714,9 @@ static const struct format_table_entry format_table[] = { { "mouse_y", FORMAT_TABLE_STRING, format_cb_mouse_y }, + { "next_session_id", FORMAT_TABLE_STRING, + format_cb_next_session_id + }, { "origin_flag", FORMAT_TABLE_STRING, format_cb_origin_flag }, @@ -29,7 +29,7 @@ #include "tmux.h" struct sessions sessions; -static u_int next_session_id; +u_int next_session_id; struct session_groups session_groups = RB_INITIALIZER(&session_groups); static void session_free(int, short, void *); @@ -4589,6 +4589,11 @@ Run when a session is renamed. Run when a window is linked into a session. .It window-renamed Run when a window is renamed. +.It window-resized +Run when a window is resized. +This may be after the +.Ar client-resized +hook is run. .It window-unlinked Run when a window is unlinked from a session. .El @@ -5093,6 +5098,7 @@ The following variables are available, where appropriate: .It Li "mouse_word" Ta "" Ta "Word under mouse, if any" .It Li "mouse_x" Ta "" Ta "Mouse X position, if any" .It Li "mouse_y" Ta "" Ta "Mouse Y position, if any" +.It Li "next_session_id" Ta "" Ta "Unique session ID for next new session" .It Li "origin_flag" Ta "" Ta "Pane origin flag" .It Li "pane_active" Ta "" Ta "1 if active pane" .It Li "pane_at_bottom" Ta "" Ta "1 if pane is at the bottom of window" @@ -3118,6 +3118,7 @@ void control_notify_session_window_changed(struct session *); /* session.c */ extern struct sessions sessions; +extern u_int next_session_id; int session_cmp(struct session *, struct session *); RB_PROTOTYPE(sessions, session, entry, session_cmp); int session_alive(struct session *); |