79 lines
2.7 KiB
Diff
79 lines
2.7 KiB
Diff
diff -rupN weston-10.0.3.orig/clients/terminal.c weston-10.0.3/clients/terminal.c
|
|
--- weston-10.0.3.orig/clients/terminal.c 2023-04-22 14:24:55.619280680 +0000
|
|
+++ weston-10.0.3/clients/terminal.c 2023-04-22 16:10:53.929276891 +0000
|
|
@@ -56,6 +56,8 @@ static char *option_font;
|
|
static int option_font_size;
|
|
static char *option_term;
|
|
static char *option_shell;
|
|
+static char *option_cwd;
|
|
+static char *option_command;
|
|
|
|
static struct wl_list terminal_list;
|
|
|
|
@@ -3089,7 +3091,13 @@ terminal_run(struct terminal *terminal,
|
|
close(pipes[0]);
|
|
setenv("TERM", option_term, 1);
|
|
setenv("COLORTERM", option_term, 1);
|
|
- if (execl(path, path, NULL)) {
|
|
+ if (option_command) {
|
|
+ if (execl(path, path, "-c", option_command, NULL)) {
|
|
+ fprintf(stderr, "command '%s' couldn't executed: %m",
|
|
+ option_command);
|
|
+ }
|
|
+ }
|
|
+ if (execl(path, path, "-l")) {
|
|
printf("exec failed: %s\n", strerror(errno));
|
|
exit(EXIT_FAILURE);
|
|
}
|
|
@@ -3123,6 +3131,8 @@ static const struct weston_option termin
|
|
{ WESTON_OPTION_STRING, "font", 0, &option_font },
|
|
{ WESTON_OPTION_INTEGER, "font-size", 0, &option_font_size },
|
|
{ WESTON_OPTION_STRING, "shell", 0, &option_shell },
|
|
+ { WESTON_OPTION_STRING, "cwd", 0, &option_cwd },
|
|
+ { WESTON_OPTION_STRING, "command", 0, &option_command },
|
|
};
|
|
|
|
int main(int argc, char *argv[])
|
|
@@ -3140,14 +3150,15 @@ int main(int argc, char *argv[])
|
|
|
|
option_shell = getenv("SHELL");
|
|
if (!option_shell)
|
|
- option_shell = "/bin/sh";
|
|
+ option_shell = "/bin/bash";
|
|
|
|
config_file = weston_config_get_name_from_env();
|
|
config = weston_config_parse(config_file);
|
|
s = weston_config_get_section(config, "terminal", NULL, NULL);
|
|
weston_config_section_get_string(s, "font", &option_font, "monospace");
|
|
- weston_config_section_get_int(s, "font-size", &option_font_size, 14);
|
|
+ weston_config_section_get_int(s, "font-size", &option_font_size, 16);
|
|
weston_config_section_get_string(s, "term", &option_term, "xterm");
|
|
+ weston_config_section_get_string(s, "command", &option_command, NULL);
|
|
weston_config_destroy(config);
|
|
|
|
if (parse_options(terminal_options,
|
|
@@ -3157,7 +3168,9 @@ int main(int argc, char *argv[])
|
|
" --maximized or -m\n"
|
|
" --font=NAME\n"
|
|
" --font-size=SIZE\n"
|
|
- " --shell=NAME\n", argv[0]);
|
|
+ " --shell=NAME\n"
|
|
+ " --cwd=PATH\n"
|
|
+ " --command=CMDLINE\n", argv[0]);
|
|
return 1;
|
|
}
|
|
|
|
@@ -3178,6 +3191,13 @@ int main(int argc, char *argv[])
|
|
|
|
wl_list_init(&terminal_list);
|
|
terminal = terminal_create(d);
|
|
+
|
|
+ if (option_cwd) {
|
|
+ if(chdir(option_cwd) == -1)
|
|
+ fprintf(stderr, "failed to changing directory as %s: %m\n",
|
|
+ option_cwd);
|
|
+ }
|
|
+
|
|
if (terminal_run(terminal, option_shell))
|
|
exit(EXIT_FAILURE);
|
|
|