From: nicm Date: Wed, 10 Apr 2024 07:36:25 +0000 (+0000) Subject: Add an option allow-set-title to forbid applications from changing the X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=8db6b63c06ea7803162d09c566da3a1a7b6d8366;p=openbsd Add an option allow-set-title to forbid applications from changing the pane title, from someone in GitHub issue 3930. --- 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 @@ -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 @@ -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 .\" @@ -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 @@ -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 */