version 1.34, 2021/10/11 10:55:30 |
version 1.35, 2021/10/14 13:19:01 |
|
|
.name = "display-popup", |
.name = "display-popup", |
.alias = "popup", |
.alias = "popup", |
|
|
.args = { "BCc:d:e:Eh:t:w:x:y:", 0, -1, NULL }, |
.args = { "Bb:Cc:d:e:Eh:t:w:x:y:", 0, -1, NULL }, |
.usage = "[-BCE] [-c target-client] [-d start-directory] " |
.usage = "[-BCE] [-b border-lines] [-c target-client] " |
"[-e environment] [-h height] " CMD_TARGET_PANE_USAGE " " |
"[-d start-directory] [-e environment] [-h height] " |
|
CMD_TARGET_PANE_USAGE " " |
"[-w width] [-x position] [-y position] [shell-command]", |
"[-w width] [-x position] [-y position] [shell-command]", |
|
|
.target = { 't', CMD_FIND_PANE, 0 }, |
.target = { 't', CMD_FIND_PANE, 0 }, |
|
|
struct client *tc = cmdq_get_target_client(item); |
struct client *tc = cmdq_get_target_client(item); |
struct tty *tty = &tc->tty; |
struct tty *tty = &tc->tty; |
const char *value, *shell, *shellcmd = NULL; |
const char *value, *shell, *shellcmd = NULL; |
char *cwd, *cause, **argv = NULL; |
char *cwd, *cause = NULL, **argv = NULL; |
int flags = 0, argc = 0; |
int flags = 0, argc = 0; |
|
enum box_lines lines = BOX_LINES_DEFAULT; |
u_int px, py, w, h, count = args_count(args); |
u_int px, py, w, h, count = args_count(args); |
struct args_value *av; |
struct args_value *av; |
struct environ *env = NULL; |
struct environ *env = NULL; |
|
struct options *o = s->curw->window->options; |
|
struct options_entry *oe; |
|
|
if (args_has(args, 'C')) { |
if (args_has(args, 'C')) { |
server_client_clear_overlay(tc); |
server_client_clear_overlay(tc); |
|
|
if (!cmd_display_menu_get_position(tc, item, args, &px, &py, w, h)) |
if (!cmd_display_menu_get_position(tc, item, args, &px, &py, w, h)) |
return (CMD_RETURN_NORMAL); |
return (CMD_RETURN_NORMAL); |
|
|
|
value = args_get(args, 'b'); |
|
if (args_has(args, 'B')) |
|
lines = BOX_LINES_NONE; |
|
else if (value != NULL) { |
|
oe = options_get(o, "popup-border-lines"); |
|
lines = options_find_choice(options_table_entry(oe), value, |
|
&cause); |
|
if (cause != NULL) { |
|
cmdq_error(item, "popup-border-lines %s", cause); |
|
free(cause); |
|
return (CMD_RETURN_ERROR); |
|
} |
|
} |
|
|
value = args_get(args, 'd'); |
value = args_get(args, 'd'); |
if (value != NULL) |
if (value != NULL) |
cwd = format_single_from_target(item, value); |
cwd = format_single_from_target(item, value); |
|
|
flags |= POPUP_CLOSEEXITZERO; |
flags |= POPUP_CLOSEEXITZERO; |
else if (args_has(args, 'E')) |
else if (args_has(args, 'E')) |
flags |= POPUP_CLOSEEXIT; |
flags |= POPUP_CLOSEEXIT; |
if (args_has(args, 'B')) |
if (popup_display(flags, lines, item, px, py, w, h, env, shellcmd, argc, |
flags |= POPUP_NOBORDER; |
argv, cwd, tc, s, NULL, NULL) != 0) { |
if (popup_display(flags, item, px, py, w, h, env, shellcmd, argc, argv, |
|
cwd, tc, s, NULL, NULL) != 0) { |
|
cmd_free_argv(argc, argv); |
cmd_free_argv(argc, argv); |
if (env != NULL) |
if (env != NULL) |
environ_free(env); |
environ_free(env); |