diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2024-04-10 07:36:26 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2024-04-10 07:36:26 +0000 |
commit | c522139198556bd49ec579ca8ae0e3c0d0b19fb2 (patch) | |
tree | fceff7c3a09f8853399d9887954816aaa719d3af | |
parent | cdfbf616ddc7bf05f186259d254957a3310d5bd6 (diff) |
Add an option allow-set-title to forbid applications from changing the
pane title, from someone in GitHub issue 3930.
-rw-r--r-- | usr.bin/tmux/input.c | 6 | ||||
-rw-r--r-- | usr.bin/tmux/options-table.c | 10 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.1 | 10 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.h | 4 |
4 files changed, 23 insertions, 7 deletions
diff --git a/usr.bin/tmux/input.c b/usr.bin/tmux/input.c index 3679cadac3d..6d67917f47d 100644 --- a/usr.bin/tmux/input.c +++ b/usr.bin/tmux/input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: input.c,v 1.223 2023/12/27 20:13:35 nicm Exp $ */ +/* $OpenBSD: input.c,v 1.224 2024/04/10 07:36:25 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -2341,7 +2341,9 @@ input_exit_osc(struct input_ctx *ictx) switch (option) { case 0: case 2: - if (screen_set_title(sctx->s, p) && wp != NULL) { + if (wp != NULL && + options_get_number(wp->options, "allow-set-title") && + screen_set_title(sctx->s, p)) { notify_pane("pane-title-changed", wp); server_redraw_window_borders(wp->window); server_status_window(wp->window); diff --git a/usr.bin/tmux/options-table.c b/usr.bin/tmux/options-table.c index 65265ce9077..919c7ce1f3f 100644 --- a/usr.bin/tmux/options-table.c +++ b/usr.bin/tmux/options-table.c @@ -1,4 +1,4 @@ -/* $OpenBSD: options-table.c,v 1.170 2024/03/21 11:53:11 nicm Exp $ */ +/* $OpenBSD: options-table.c,v 1.171 2024/04/10 07:36:25 nicm Exp $ */ /* * Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -876,6 +876,14 @@ const struct options_table_entry options_table[] = { "to rename windows." }, + { .name = "allow-set-title", + .type = OPTIONS_TABLE_FLAG, + .scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE, + .default_num = 1, + .text = "Whether applications are allowed to use the escape sequence " + "to set the pane title." + }, + { .name = "alternate-screen", .type = OPTIONS_TABLE_FLAG, .scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE, diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1 index bf0344bca9c..83e1f119364 100644 --- a/usr.bin/tmux/tmux.1 +++ b/usr.bin/tmux/tmux.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tmux.1,v 1.940 2024/03/21 11:53:11 nicm Exp $ +.\" $OpenBSD: tmux.1,v 1.941 2024/04/10 07:36:25 nicm Exp $ .\" .\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> .\" @@ -14,7 +14,7 @@ .\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING .\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: March 21 2024 $ +.Dd $Mdocdate: April 10 2024 $ .Dt TMUX 1 .Os .Sh NAME @@ -4750,6 +4750,12 @@ they will be allowed even if the pane is invisible. Allow programs in the pane to change the window name using a terminal escape sequence (\eek...\ee\e\e). .Pp +.It Xo Ic allow-set-title +.Op Ic on | off +.Xc +Allow programs in the pane to change the title using the terminal escape +sequences (\ee]2;...\ee\e\e or \ee]0;...\ee\e\e). +.Pp .It Xo Ic alternate-screen .Op Ic on | off .Xc diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index 3eea22028e6..4af59adf4e5 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.1213 2024/03/21 11:30:42 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.1214 2024/04/10 07:36:25 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -850,7 +850,7 @@ struct screen_sel; struct screen_titles; struct screen { char *title; - char *path; + char *path; struct screen_titles *titles; struct grid *grid; /* grid data */ |