Add -S and -s options to style floating panes.

This commit is contained in:
Michael Grant
2026-03-24 17:49:55 +00:00
parent ef01e9daf8
commit 75ed7b27c6
5 changed files with 147 additions and 20 deletions

View File

@@ -35,10 +35,10 @@ const struct cmd_entry cmd_new_pane_entry = {
.name = "new-pane",
.alias = "newp",
.args = { "bc:de:fF:h:Iklm:p:Pt:w:x:y:Z", 0, -1, NULL },
.args = { "bc:de:fF:h:Iklm:p:Ps:S:t:w:x:y:Z", 0, -1, NULL },
.usage = "[-bdefhIklPvZ] [-c start-directory] [-e environment] "
"[-F format] [-l size] [-m message] " CMD_TARGET_PANE_USAGE
" [shell-command [argument ...]]",
"[-F format] [-l size] [-m message] [-s style] [-S border-style] "
CMD_TARGET_PANE_USAGE " [shell-command [argument ...]]",
.target = { 't', CMD_FIND_PANE, 0 },
@@ -62,7 +62,7 @@ cmd_new_pane_exec(struct cmd *self, struct cmdq_item *item)
struct layout_cell *lc;
struct cmd_find_state fs;
int flags, input;
const char *template;
const char *template, *style;
char *cause = NULL, *cp;
struct args_value *av;
u_int count = args_count(args);
@@ -204,6 +204,27 @@ cmd_new_pane_exec(struct cmd *self, struct cmdq_item *item)
environ_free(sc.environ);
return (CMD_RETURN_ERROR);
}
style = args_get(args, 's');
if (style != NULL) {
if (options_set_string(new_wp->options, "window-style", 0,
"%s", style) == NULL) {
cmdq_error(item, "bad style: %s", style);
return (CMD_RETURN_ERROR);
}
options_set_string(new_wp->options, "window-active-style", 0,
"%s", style);
new_wp->flags |= (PANE_REDRAW|PANE_STYLECHANGED|PANE_THEMECHANGED);
}
style = args_get(args, 'S');
if (style != NULL) {
if (options_set_string(new_wp->options, "pane-border-style", 0,
"%s", style) == NULL) {
cmdq_error(item, "bad border style: %s", style);
return (CMD_RETURN_ERROR);
}
options_set_string(new_wp->options, "pane-active-border-style",
0, "%s", style);
}
if (args_has(args, 'k') || args_has(args, 'm')) {
options_set_number(new_wp->options, "remain-on-exit", 3);
if (args_has(args, 'm'))