From cc57913d7a76f957523b450966ae09255034310e Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 14 Apr 2026 07:16:02 +0000 Subject: [PATCH 1/7] Add WAYLAND_DISPLAY to default update-environment, GitHub issue 4965 from wgh at torlan dot ru. --- options-table.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/options-table.c b/options-table.c index 55abe679..6d1e6552 100644 --- a/options-table.c +++ b/options-table.c @@ -415,10 +415,10 @@ const struct options_table_entry options_table[] = { .choices = options_table_get_clipboard_list, .default_num = 1, .text = "When an application requests the clipboard, whether to " - "ignore the request ('off'); respond with the newest buffer " - "('buffer'); request the clipboard from the most recently " - "used terminal ('request'); or to request the clipboard, " - "create a buffer, and send it to the application ('both')." + "ignore the request ('off'); respond with the newest buffer " + "('buffer'); request the clipboard from the most recently " + "used terminal ('request'); or to request the clipboard, " + "create a buffer, and send it to the application ('both')." }, { .name = "history-file", @@ -1025,7 +1025,8 @@ const struct options_table_entry options_table[] = { .scope = OPTIONS_TABLE_SESSION, .flags = OPTIONS_TABLE_IS_ARRAY, .default_str = "DISPLAY KRB5CCNAME MSYSTEM SSH_ASKPASS SSH_AUTH_SOCK " - "SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY", + "SSH_AGENT_PID SSH_CONNECTION WAYLAND_DISPLAY " + "WINDOWID XAUTHORITY", .text = "List of environment variables to update in the session " "environment when a client is attached." }, From a11363e9e7c3dca151a773193c1d0a2fad39180e Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 14 Apr 2026 07:24:23 +0000 Subject: [PATCH 2/7] Limit precision to 100 to stop silly formats from running out of memory, reported by z1281552865 at gmail dot com. --- format.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/format.c b/format.c index db769668..9e671428 100644 --- a/format.c +++ b/format.c @@ -90,6 +90,9 @@ format_job_cmp(struct format_job *fj1, struct format_job *fj2) /* Maimum repeat size. */ #define FORMAT_MAX_REPEAT 10000 +/* Maimum precision. */ +#define FORMAT_MAX_PRECISION 100 + /* Format modifiers. */ #define FORMAT_TIMESTRING 0x1 #define FORMAT_BASENAME 0x2 @@ -4850,7 +4853,8 @@ format_replace_expression(struct format_modifier *mexp, /* The third argument may be precision. */ if (argc >= 3) { - prec = strtonum(mexp->argv[2], INT_MIN + 1, INT_MAX, &errstr); + prec = strtonum(mexp->argv[2], -FORMAT_MAX_PRECISION, + FORMAT_MAX_PRECISION, &errstr); if (errstr != NULL) { format_log(es, "expression precision %s: %s", errstr, mexp->argv[2]); From 51109e3f72c4429b6213e7c9329ab232fd9111ea Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 14 Apr 2026 07:26:45 +0000 Subject: [PATCH 3/7] Include window bits for pane notifications, GitHub issue 5007 from Saul Nogueras. --- notify.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/notify.c b/notify.c index aadfd450..ac5d2e92 100644 --- a/notify.c +++ b/notify.c @@ -209,8 +209,12 @@ notify_add(const char *name, struct cmd_find_state *fs, struct client *c, format_add(ne->formats, "hook_window", "@%u", w->id); format_add(ne->formats, "hook_window_name", "%s", w->name); } - if (wp != NULL) + if (wp != NULL) { format_add(ne->formats, "hook_pane", "%%%d", wp->id); + format_add(ne->formats, "hook_window", "@%u", wp->window->id); + format_add(ne->formats, "hook_window_name", "%s", + wp->window->name); + } format_log_debug(ne->formats, __func__); if (c != NULL) From 663e82bc19b01a1809d845a27e552f9f1c208483 Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 14 Apr 2026 07:28:57 +0000 Subject: [PATCH 4/7] Fix key binding conflict in session menu, from Dane Jensen. --- key-bindings.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/key-bindings.c b/key-bindings.c index a6c726f6..85fa7c80 100644 --- a/key-bindings.c +++ b/key-bindings.c @@ -29,7 +29,7 @@ " 'Previous' 'p' {switch-client -p}" \ " ''" \ " 'Renumber' 'N' {move-window -r}" \ - " 'Rename' 'n' {command-prompt -I \"#S\" {rename-session -- '%%'}}" \ + " 'Rename' 'r' {command-prompt -I \"#S\" {rename-session -- '%%'}}" \ " ''" \ " 'New Session' 's' {new-session}" \ " 'New Window' 'w' {new-window}" From 86d4d5689cb53372ff3766016a954d69428d149a Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 14 Apr 2026 07:35:17 +0000 Subject: [PATCH 5/7] Add detach to default session menu, suggested by Przemyslaw Sztoch. --- key-bindings.c | 1 + 1 file changed, 1 insertion(+) diff --git a/key-bindings.c b/key-bindings.c index 85fa7c80..9bc69045 100644 --- a/key-bindings.c +++ b/key-bindings.c @@ -30,6 +30,7 @@ " ''" \ " 'Renumber' 'N' {move-window -r}" \ " 'Rename' 'r' {command-prompt -I \"#S\" {rename-session -- '%%'}}" \ + " 'Detach' 'd' {detach-client}" \ " ''" \ " 'New Session' 's' {new-session}" \ " 'New Window' 'w' {new-window}" From 31c93c483afa4f94ef2091c8d9f25db4731d0e7f Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 14 Apr 2026 08:32:30 +0000 Subject: [PATCH 6/7] Another check for partially initialized control client, from Matt Koscica in GitHub issue 5004. --- control.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/control.c b/control.c index 00544aa1..e4efb01f 100644 --- a/control.c +++ b/control.c @@ -829,6 +829,9 @@ control_stop(struct client *c) struct control_block *cb, *cb1; struct control_sub *csub, *csub1; + if (cs == NULL) + return; + if (~c->flags & CLIENT_CONTROLCONTROL) bufferevent_free(cs->write_event); bufferevent_free(cs->read_event); @@ -842,6 +845,7 @@ control_stop(struct client *c) control_free_block(cs, cb); control_reset_offsets(c); + c->control_state = NULL; free(cs); } From 67e6f8245b63485d374b1dd87655e0245094ae64 Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 14 Apr 2026 08:39:10 +0000 Subject: [PATCH 7/7] If job_run fails, do not crash but instead free the popup. --- popup.c | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/popup.c b/popup.c index 4ef1cc0a..c31977ba 100644 --- a/popup.c +++ b/popup.c @@ -104,6 +104,27 @@ static const struct menu_item popup_internal_menu_items[] = { { NULL, KEYC_NONE, NULL } }; +static void +popup_free(struct popup_data *pd) +{ + server_client_unref(pd->c); + + if (pd->job != NULL) + job_free(pd->job); + input_free(pd->ictx); + + free(pd->or[0].ranges); + free(pd->or[1].ranges); + free(pd->r.ranges); + screen_free(&pd->s); + colour_palette_free(&pd->palette); + + free(pd->title); + free(pd->style); + free(pd->border_style); + free(pd); +} + static void popup_reapply_styles(struct popup_data *pd) { @@ -344,22 +365,8 @@ popup_free_cb(struct client *c, void *data) cmdq_get_client(item)->retval = pd->status; cmdq_continue(item); } - server_client_unref(pd->c); - if (pd->job != NULL) - job_free(pd->job); - input_free(pd->ictx); - - free(pd->or[0].ranges); - free(pd->or[1].ranges); - free(pd->r.ranges); - screen_free(&pd->s); - colour_palette_free(&pd->palette); - - free(pd->title); - free(pd->style); - free(pd->border_style); - free(pd); + popup_free(pd); } static void @@ -858,6 +865,10 @@ popup_display(int flags, enum box_lines lines, struct cmdq_item *item, u_int px, pd->job = job_run(shellcmd, argc, argv, env, s, cwd, popup_job_update_cb, popup_job_complete_cb, NULL, pd, JOB_NOWAIT|JOB_PTY|JOB_KEEPWRITE|JOB_DEFAULTSHELL, jx, jy); + if (pd->job == NULL) { + popup_free(pd); + return (-1); + } pd->ictx = input_init(NULL, job_get_event(pd->job), &pd->palette, c); }