Add modal panes, created currently with new-pane -O. There is one modal

pane per window and it must be a floating pane. These are intended to
replace popups. Currently a modal pane will unzoom a zoomed window and
rezoom it when it is closed (a bit like modes do), but this is planned
to change when we get an always-on-top flag.
This commit is contained in:
nicm
2026-07-15 13:02:33 +00:00
committed by tmux update bot
parent 75c874c55b
commit d98635e1bd
13 changed files with 239 additions and 32 deletions

View File

@@ -1,4 +1,4 @@
/* $OpenBSD: format.c,v 1.404 2026/07/14 15:06:54 nicm Exp $ */
/* $OpenBSD: format.c,v 1.405 2026/07/15 13:02:33 nicm Exp $ */
/*
* Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -1074,6 +1074,20 @@ format_cb_pane_floating_flag(struct format_tree *ft)
return (NULL);
}
/* Callback for pane_modal_flag. */
static void *
format_cb_pane_modal_flag(struct format_tree *ft)
{
struct window_pane *wp = ft->wp;
if (wp != NULL) {
if (wp == wp->window->modal)
return (xstrdup("1"));
return (xstrdup("0"));
}
return (NULL);
}
/* Callback for pane_bg. */
static void *
format_cb_pane_bg(struct format_tree *ft)
@@ -3084,6 +3098,15 @@ format_cb_window_marked_flag(struct format_tree *ft)
return (NULL);
}
/* Callback for window_modal_pane. */
static void *
format_cb_window_modal_pane(struct format_tree *ft)
{
if (ft->w != NULL && ft->w->modal != NULL)
return (format_printf("%%%u", ft->w->modal->id));
return (NULL);
}
/* Callback for window_name. */
static void *
format_cb_window_name(struct format_tree *ft)
@@ -3666,6 +3689,9 @@ static const struct format_table_entry format_table[] = {
{ "pane_marked_set", FORMAT_TABLE_STRING,
format_cb_pane_marked_set
},
{ "pane_modal_flag", FORMAT_TABLE_STRING,
format_cb_pane_modal_flag
},
{ "pane_mode", FORMAT_TABLE_STRING,
format_cb_pane_mode
},
@@ -3924,6 +3950,9 @@ static const struct format_table_entry format_table[] = {
{ "window_marked_flag", FORMAT_TABLE_STRING,
format_cb_window_marked_flag
},
{ "window_modal_pane", FORMAT_TABLE_STRING,
format_cb_window_modal_pane
},
{ "window_name", FORMAT_TABLE_STRING,
format_cb_window_name
},