From 3c2ccb0f0c0c6ca9b8a02b9580be90cce340e4ff Mon Sep 17 00:00:00 2001 From: ZjYwMj <27451609+ZjYwMj@users.noreply.github.com> Date: Sun, 15 Aug 2021 12:53:01 +0000 Subject: [PATCH 1/6] [1/3] Update lxterminal.h: multiple --command=, run multiple commands from the command line The reader is kindly asked to pay attention for the s letter, or absent of, and to the = character, or absent of, in the seemingly no difference --command, --command= and --commands= terms. In what follows, these 3 different terms are totally different. With the current stable implementation, with multiple --command= command line options, only the last one was used. It override the previous occurrences of --command=. As promised at https://github.com/lxde/lxterminal/pull/98#issuecomment-888600876, this code modifies that. With it, all the commands specified with --command= option will run. Each one at a different tab. Each command is automatically paired with a tab. After exhausting existing tabs, new tabs will be automatically created. This feature does not lift the basic limitation of commands in lxterminal command line. Which is, that short lived processes makes the tab they ran within, or the whole window in case of only short lived processes, to get closed as soon as the short lived processes have terminated. This limitation is shortly described in the modified man page. This patch constitutes of modifying 3 files: 1. src/lxterminal.h 2. src/lxterminal.c 3. man/lxterminal.xml Lightly tested. The modification of lxterminal.xml, beside describing the new behavior of the --command= option, also describes, in some length, some pitfalls of lxterminal. --- src/lxterminal.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lxterminal.h b/src/lxterminal.h index 328c7432..67a74da4 100644 --- a/src/lxterminal.h +++ b/src/lxterminal.h @@ -70,6 +70,7 @@ typedef struct _term { GtkWidget * scrollbar; /* Scroll bar, child of horizontal box */ GPid pid; /* Process ID of the process that has this as its terminal */ GClosure * closure; /* Accelerator structure */ + gchar * * command; /* Memory allocated by glib */ gchar * matched_url; gboolean open_menu_on_button_release; gulong exit_handler_id; @@ -79,6 +80,7 @@ typedef struct _term { typedef struct _command_arguments { char * executable; /* Value of argv[0]; points into argument vector */ gchar * * command; /* Value of -e, --command; memory allocated by glib */ + gchar * * commands; /* Accumulated values of --command=; pointers into argument vector */ int geometry_bitmask; unsigned int geometry_columns; /* Value of --geometry */ unsigned int geometry_rows; From 4b49a7b40472af80e52dff694b4263169d9e69eb Mon Sep 17 00:00:00 2001 From: ZjYwMj <27451609+ZjYwMj@users.noreply.github.com> Date: Sun, 15 Aug 2021 13:15:52 +0000 Subject: [PATCH 2/6] [2/3] Update lxterminal.c: multiple --command=, run multiple commands from the command line The reader is kindly asked to pay attention for the s letter, or absent of, and to the = character, or absent of, in the seemingly no difference --command, --command= and --commands= terms. In what follows, these 3 different terms are totally different. With the current stable implementation, with multiple --command= command line options, only the last one was used. It override the previous ocurences of --command=. As promised at https://github.com/lxde/lxterminal/pull/98#issuecomment-888600876, this code modifies that. With it, all the commands specified with --command= option will run. Each one at a different tab. Each command is automatically paired with a tab. After exhausting existing tabs, new tabs will be automatically created. This feature does not lift the basic limitation of commands in lxterminal command line. Which is, that short lived processes makes the tab they ran within, or the whole window in case of only short lived processes, to get closed as soon as the short lived processes have terminated. This limitation is shortly described in the modified man page. This patch constitutes of modifying 3 files: 1. src/lxterminal.h 2. src/lxterminal.c 3. man/lxterminal.xml Lightly tested. The modification of lxterminal.xml, beside describing the new behavior of the --command= option, also describes, in some length, some pitfalls of lxterminal. --- src/lxterminal.c | 152 ++++++++++++++++++++++++++++++----------------- 1 file changed, 97 insertions(+), 55 deletions(-) diff --git a/src/lxterminal.c b/src/lxterminal.c index 142d6a68..dbc9cd27 100644 --- a/src/lxterminal.c +++ b/src/lxterminal.c @@ -97,13 +97,14 @@ static gboolean terminal_vte_button_press_event(VteTerminal * vte, GdkEventButto static void terminal_settings_apply_to_term(LXTerminal * terminal, Term * term); static Term * terminal_new(LXTerminal * terminal, const gchar * label, const gchar * pwd, gchar * * env, gchar * * exec); static void terminal_set_geometry_hints(Term * term, GdkGeometry * geometry); -static void terminal_new_tab(LXTerminal * terminal, const gchar * label); +static void terminal_new_tab(LXTerminal * terminal, const gchar * label, const gchar * cmd); static void terminal_free(Term * term); static void terminal_menubar_initialize(LXTerminal * terminal); static void terminal_menu_accelerator_update(LXTerminal * terminal); static void terminal_settings_apply(LXTerminal * terminal); static void terminal_update_menu_shortcuts(Setting * setting); static void terminal_initialize_menu_shortcuts(Setting * setting); +static void terminal_process_requested_command(gchar * * * const command, const gint cmd_len, const gboolean login_shell); /* Menu accelerator saved when the user disables it. */ static char * saved_menu_accelerator = NULL; @@ -113,8 +114,10 @@ static gchar usage_display[] = { "Usage:\n" " lxterminal [Options...] - LXTerminal is a terminal emulator\n\n" "Options:\n" - " -e, --command=STRING Execute the argument to this option inside the terminal\n" + " --command=STRING [--command=STRING [...]],\n" + " -e STRING, --command STRING Execute the argument to this option inside the terminal\n" " --geometry=COLUMNSxROWS Set the terminal's size\n" + " -h, --help This help text\n" " -l, --loginshell Execute login shell\n" " -t, -T, --title=,\n" " --tabs=NAME[,NAME[,NAME[...]]] Set the terminal's title\n" @@ -293,7 +296,8 @@ static void terminal_initialize_switch_tab_accelerator(Term * term) { /* Formulate the accelerator name. */ char switch_tab_accel[1 + 3 + 1 + 1 + 1]; /* "n" */ - sprintf(switch_tab_accel, "%d", term->index + 1); + /* Casting to unsigned, and %10, to shut off a compilation warning. */ + sprintf(switch_tab_accel, "%d", (guint)(term->index + 1)%10); /* Parse the accelerator name. */ guint key; @@ -373,7 +377,7 @@ static void terminal_new_window_activate_event(GtkAction * action, LXTerminal * * Open a new tab. */ static void terminal_new_tab_activate_event(GtkAction * action, LXTerminal * terminal) { - terminal_new_tab(terminal, NULL); + terminal_new_tab(terminal, NULL, NULL); } static void terminal_set_geometry_hints(Term *term, GdkGeometry *geometry) @@ -410,7 +414,7 @@ static void terminal_save_size(LXTerminal * terminal) terminal->row = vte_terminal_get_row_count(VTE_TERMINAL(term->vte)); } -static void terminal_new_tab(LXTerminal * terminal, const gchar * label) +static void terminal_new_tab(LXTerminal * terminal, const gchar * label, const gchar * cmd) { Term * term; gchar * proc_cwd = terminal_get_current_dir(terminal); @@ -419,21 +423,14 @@ static void terminal_new_tab(LXTerminal * terminal, const gchar * label) * If the working directory was determined above, use it; otherwise default to the working directory of the process. * Create the new terminal. */ - if (terminal->login_shell) + gint cmd_len = 0; + gchar * * exec = NULL; + if (cmd != NULL) { - /* Create a login shell, this should be cleaner. */ - gchar * * exec = g_malloc(3 * sizeof(gchar *)); - exec[0] = g_strdup(terminal_get_preferred_shell()); - char * shellname = g_path_get_basename(exec[0]); - exec[1] = g_strdup_printf("-%s", shellname); - g_free(shellname); - exec[2] = NULL; - term = terminal_new(terminal, label, proc_cwd, NULL, exec); - } - else - { - term = terminal_new(terminal, label, proc_cwd, NULL, NULL); + g_shell_parse_argv(cmd, &cmd_len, &exec, NULL); } + terminal_process_requested_command(&exec, cmd_len, terminal->login_shell); + term = terminal_new(terminal, label, proc_cwd, NULL, exec); g_free(proc_cwd); /* Add a tab to the notebook and the "terms" array. */ @@ -1315,6 +1312,7 @@ static Term * terminal_new(LXTerminal * terminal, const gchar * label, const gch exec[1] = g_path_get_basename(exec[0]); exec[2] = NULL; } + term->command = exec; #if VTE_CHECK_VERSION (0, 38, 0) vte_terminal_spawn_sync( @@ -1342,7 +1340,6 @@ static Term * terminal_new(LXTerminal * terminal, const gchar * label, const gch &term->pid, NULL); #endif - g_strfreev(exec); /* Connect signals. */ g_signal_connect(G_OBJECT(term->tab), "button-press-event", G_CALLBACK(terminal_tab_button_press_event), term); @@ -1365,6 +1362,7 @@ static Term * terminal_new(LXTerminal * terminal, const gchar * label, const gch /* Deallocate a Term structure. */ static void terminal_free(Term * term) { + g_strfreev(term->command); g_free(term->matched_url); if ((GTK_IS_ACCEL_GROUP(term->parent->accel_group)) && (term->closure != NULL)) { @@ -1431,7 +1429,7 @@ gboolean lxterminal_process_arguments(gint argc, gchar * * argv, CommandArgument arguments->executable = argv[0]; char * * argv_cursor = argv; - gint cmd_len; + gint num___commandEqual = 0; /* ___commandEqual for _--command= */ while (argc > 1) { @@ -1439,19 +1437,23 @@ gboolean lxterminal_process_arguments(gint argc, gchar * * argv, CommandArgument argv_cursor ++; char * argument = *argv_cursor; - /* --command= */ + /* --command= */ if (strncmp(argument, "--command=", 10) == 0) { - g_strfreev(arguments->command); - g_shell_parse_argv(&argument[10], &cmd_len, &arguments->command, NULL); + arguments->commands = + g_realloc(arguments->commands, + (num___commandEqual + 2) * sizeof(gchar *)); + arguments->commands[num___commandEqual] = &argument[10]; + num___commandEqual ++; + arguments->commands[num___commandEqual] = NULL; } /* -e , --command * The behavior is demanded by distros who insist on this xterm feature. */ else if ((strcmp(argument, "--command") == 0) || (strcmp(argument, "-e") == 0)) { - if(arguments->command != NULL) g_strfreev(arguments->command); - cmd_len = 0; + g_strfreev(arguments->command); + gint cmd_len = 0; arguments->command = g_malloc(argc * sizeof(gchar *)); while (argc > 1) @@ -1521,7 +1523,7 @@ gboolean lxterminal_process_arguments(gint argc, gchar * * argv, CommandArgument arguments->working_directory = &argument[20]; } - /* --no-remote: Do not accept or send remote commands */ + /* --no-remote: Do not accept or send remote commands */ else if (strcmp(argument, "--no-remote") == 0) { arguments->no_remote = TRUE; } @@ -1536,28 +1538,35 @@ gboolean lxterminal_process_arguments(gint argc, gchar * * argv, CommandArgument else { printf("%s\n", usage_display); return FALSE; + } } - } + return TRUE; +} + +/* Furthere process a command before executing it. Handle out of path, and login shell.*/ +static void terminal_process_requested_command(gchar * * * const command, const gint cmd_len, const gboolean login_shell) +{ + gboolean force_login_shell = FALSE; /* Handle --loginshell. */ - if (arguments->command != NULL && cmd_len <= 2) { + if (*command != NULL && cmd_len <= 2) { /* Force using login shell if it has only 1 command, and command is not * in PATH. */ - gchar * program_path = g_find_program_in_path(arguments->command[0]); + gchar * program_path = g_find_program_in_path((*command)[0]); if (program_path == NULL) { - arguments->login_shell = TRUE; + force_login_shell = TRUE; } g_free(program_path); } - if (arguments->login_shell == TRUE) + if (login_shell == TRUE || force_login_shell == TRUE) { const gchar * shell = terminal_get_preferred_shell(); gchar * shellname = g_path_get_basename(shell); - if (arguments->command == NULL) + if (*command == NULL) { - arguments->command = g_malloc(3 * sizeof(gchar *)); - arguments->command[0] = g_strdup(shell); - arguments->command[1] = g_strdup_printf("-%s", shellname); - arguments->command[2] = NULL; + *command = g_malloc(3 * sizeof(gchar *)); + (*command)[0] = g_strdup(shell); + (*command)[1] = g_strdup_printf("-%s", shellname); + (*command)[2] = NULL; } else { @@ -1565,26 +1574,25 @@ gboolean lxterminal_process_arguments(gint argc, gchar * * argv, CommandArgument tmp[0] = g_strdup(shell); tmp[1] = g_strdup_printf("-%s", shellname); tmp[2] = g_strdup("-c"); - memcpy((tmp + 3), arguments->command, cmd_len * sizeof(gchar *)); + memcpy((tmp + 3), *command, cmd_len * sizeof(gchar *)); tmp[cmd_len + 3] = NULL; - g_free(arguments->command); - arguments->command = tmp; + g_free(*command); + *command = tmp; } g_free(shellname); } else { - if(arguments->command != NULL) + if (*command != NULL) { gchar * * tmp = g_malloc((cmd_len + 2) * sizeof(gchar *)); - tmp[0] = g_strdup(arguments->command[0]); - memcpy((tmp + 1), arguments->command, cmd_len * sizeof(gchar *)); + tmp[0] = g_strdup((*command)[0]); + memcpy((tmp + 1), *command, cmd_len * sizeof(gchar *)); tmp[cmd_len + 1] = NULL; - g_free(arguments->command); - arguments->command = tmp; + g_free(*command); + *command = tmp; } } - return TRUE; } /* Initialize a new LXTerminal. @@ -1670,12 +1678,27 @@ LXTerminal * lxterminal_initialize(LXTermWindow * lxtermwin, CommandArguments * { local_working_directory = g_get_current_dir(); } + gchar * * command = NULL; + gint cmd_len = 0; + if (arguments->command != NULL) + { + command = g_strdupv(arguments->command); + /* This duplication is meant to help unify the rest of the code. + * In particular, when freeing the memory of the --commands= options, + * there will be no need to differentiate the --command case. */ + cmd_len = (gint)g_strv_length(arguments->command); + } + else if (arguments->commands != NULL) + { + g_shell_parse_argv(arguments->commands[0], &cmd_len, &command, NULL); + } + terminal_process_requested_command(&command, cmd_len, arguments->login_shell); Term * term = terminal_new( terminal, ((arguments->title != NULL) ? arguments->title : NULL), ((arguments->working_directory != NULL) ? arguments->working_directory : local_working_directory), NULL, - arguments->command); + command); g_free(local_working_directory); /* Set window title. */ @@ -1761,18 +1784,37 @@ LXTerminal * lxterminal_initialize(LXTermWindow * lxtermwin, CommandArguments * /* Update terminal settings. */ terminal_settings_apply(terminal); - if (arguments->tabs != NULL && arguments->tabs[0] != '\0') + if (arguments->tabs != NULL && arguments->tabs[0] != '\0' + || arguments->commands != NULL) { - /* use token to destructively slice tabs to different tab names */ - char * token = strtok(arguments->tabs, ","); - term->user_specified_label = TRUE; - gtk_label_set_text(GTK_LABEL(term->label), token); - token = strtok(NULL, ","); + gchar * tab = NULL; + if (arguments->tabs != NULL && arguments->tabs[0] != '\0') + { + /* Use tab to destructively slice tabs to different tab names */ + tab = strtok(arguments->tabs, ","); + term->user_specified_label = TRUE; + gtk_label_set_text(GTK_LABEL(term->label), tab); + /* Initially, the 1st tab is hidden */ + tab = strtok(NULL, ","); + } + gchar * * cmd = arguments->commands; + if (cmd != NULL) + { + if (arguments->command == NULL) + { + cmd ++; /* Initialy, hidden tab runs 1st command from --command=. */ + } + } - while (token != NULL && token[0] != '\0') + while (tab != NULL && tab[0] != '\0' || cmd != NULL && *cmd != NULL) { - terminal_new_tab(terminal, token); - token = strtok(NULL, ","); + terminal_new_tab(terminal, tab, cmd != NULL ? *cmd : NULL); + if (tab != NULL && tab[0] != '\0') + tab = strtok(NULL, ","); + if (cmd != NULL && *cmd != NULL) + { + cmd ++; + } } } From 8ec141de35b13adb7a6815e75f471a99a3e8da73 Mon Sep 17 00:00:00 2001 From: ZjYwMj <27451609+ZjYwMj@users.noreply.github.com> Date: Sun, 15 Aug 2021 13:21:24 +0000 Subject: [PATCH 3/6] [3/3] Update lxterminal.xml: multiple --command=, run multiple commands from the command line The reader is kindly asked to pay attention for the s letter, or absent of, and to the = character, or absent of, in the seemingly no difference --command, --command= and --commands= terms. In what follows, these 3 different terms are totally different. With the current stable implementation, with multiple --command= command line options, only the last one was used. It override the previous occurrences of --command=. As promised at https://github.com/lxde/lxterminal/pull/98#issuecomment-888600876, this code modifies that. With it, all the commands specified with --command= option will run. Each one at a different tab. Each command is automatically paired with a tab. After exhausting existing tabs, new tabs will be automatically created. This feature does not lift the basic limitation of commands in lxterminal command line. Which is, that short lived processes makes the tab they ran within, or the whole window in case of only short lived processes, to get closed as soon as the short lived processes have terminated. This limitation is shortly described in the modified man page. This patch constitutes of modifying 3 files: 1. src/lxterminal.h 2. src/lxterminal.c 3. man/lxterminal.xml Lightly tested. The modification of lxterminal.xml, beside describing the new behavior of the --command= option, also describes, in some length, some pitfalls of lxterminal. --- man/lxterminal.xml | 67 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 58 insertions(+), 9 deletions(-) diff --git a/man/lxterminal.xml b/man/lxterminal.xml index d2859e00..15b75a4b 100644 --- a/man/lxterminal.xml +++ b/man/lxterminal.xml @@ -24,8 +24,7 @@ DESCRIPTION - This manual page documents briefly the - lxterminal command. + This manual page documents the lxterminal command. lxterminal is a program that provides a terminal emulator @@ -42,12 +41,11 @@ - + - This option specifies the program (and its command line arguments) to be run in the terminal. -Except in the form, this must be the last option on the command line. + These options specifies the program (and its command line arguments) to be run in the terminal. Except in the form, this must be the last option on the command line, since the following arguments, if there are any, will be considered related to the program to be run. Multiple options, each specify a single program (and its command line arguments), create multiple tabs, each running the respective program. New tabs will be created as necessary, after all the explictly requested will be exhausted. @@ -55,17 +53,24 @@ Except in the form, this must be the last option on Set the terminal's size in characters and lines. + + + + Prints a short help message, and exit. + + Executes login shell. - - - + + + + - Set the terminal's title. Use comma for multiple tabs. + Set the terminal's title. Comma separated multiple titles create multiple tabs only with the form. @@ -73,6 +78,50 @@ Except in the form, this must be the last option on Set the terminal's working directory. + + + + Prints the program version, and exit. + + + + + + EXAMPLES, AND MORE DETAILS + + + + A hidden tab is created when , or any variant, is requested, with no more than one command, or no more than one tab, is specified. For example, + lxterminal --tabs= --no-remote + This hidden tab can be revealed when the lxterminal is running. For example, when requesting a new tab with the Shift+Ctrl+T combination keys. + + + +For display puposes, the command examples might be broken into more than one line. When actually using the examples, commands should be entered in a single line. Or have line breaks according to the usual shell conventions. + All command examples here use to avoid interaction with possibly running lxterminals. + + + + Consider + lxterminal --no-remote --command='/bin/bash -c "echo This window will be closed after you will press enter. ; read -p \"Do press the <enter> key.\" " ' + This example emphasizes a limitaion of running commands from the lxterminal command line. As a result, the feature to run a command from the lxterminal command line is much more useful for processes that exit by the user explicit request. Such as an interactive shell. A short lived process does work. Only that it is fast enough to make the window, or the tab, closed before the user can pay attention. For a short lived process, such as + lxterminal --no-remote --tabs=ls,"Midnight Commander" --command=ls --command=mc + , the user must have indirect means to inspect the outcome of the command, if he wishes to. Such as redirecting the output to a file. + + + + + lxterminal --no-remote --tabs='1st tab',"2nd tab" --tabs= --no-remote + In contrast to many other applications, repeating a command line is not an error. With some s, the right most occurence overrides previous ocuurences. But there are exceptions. The left most will always be executed in the 1st tab. Unless , or , was specified. As stated earlier, multiple are commulative in the sense that each will be executed. Just try out if it is a concern for you. The behaviour is deterministic. + + + + + The comma character, ',', is used as the separator for the titles to the option. + lxterminal --tabs="midnight commander,2nd tab" --command=mc --no-remote + There is no way to insert a comma character in the titles to be displayed by . The comma character can be used for the similar options for giving a title, such as . But these other options do not offer mutltiple tabs. + + From 0d944f1acba89889cd89ada23a7e024ffd217259 Mon Sep 17 00:00:00 2001 From: ZjYwMj <27451609+ZjYwMj@users.noreply.github.com> Date: Fri, 1 Oct 2021 16:16:42 +0000 Subject: [PATCH 4/6] Updating the description of the -n in the man page So that users will have more information about the security implications --- lxterminal.xml | 152 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100644 lxterminal.xml diff --git a/lxterminal.xml b/lxterminal.xml new file mode 100644 index 00000000..8f40e957 --- /dev/null +++ b/lxterminal.xml @@ -0,0 +1,152 @@ + +
grandpaul@gmail.com +
+ Ying-Chun + Liu + + 2008 + paulliu + + Jun 28, 2008 +
+ LXTERMINAL +http://LXDE.org + + 1 + + lxterminal + + a lightweight terminal emulator based on GTK+ for the LXDE desktop. + + lxterminal + + + + DESCRIPTION + + This manual page documents the lxterminal command. + + lxterminal is a program that provides a terminal + emulator + for the desktop, usually for LXDE. + + + + + OPTIONS + + This program follows the usual GNU command line syntax, + with long options starting with two dashes (`-'). A summary of + options is included below. + + + + + + + These options specifies the program (and its command line arguments) to be run in the terminal. Except in the form, this must be the last option on the command line, since the following arguments, if there are any, will be considered related to the program to be run. Multiple options, each specify a single program (and its command line arguments), create multiple tabs, each running the respective program. New tabs will be created as necessary, after all the explictly requested will be exhausted. + + + + + Set the terminal's size in characters and lines. + + + + + + Prints a short help message, and exit. + + + + + + Executes login shell. + + + + + + Normally, LXTerminal uses a single controller for all of the LXTerminal windows of a user and host pair. The first LXTerminal to start, without this option stated on its command line, will act as the controller. Any subsequent LXTerminals, of that user on that host, will be a client of that controller. They will do no work of their own. If, for any reason, any LXTerminal, of the same user and host pair, will fail using that controller, it will fall back to running standalone; it will not be either the controller, or a client, of another LXTerminal. With this option stated in the command line, the created LXTerminal will act the same. It will run standalone; it will not be either the controller, or a client, of another LXTerminal. + + + + + + + + + Set the terminal's title. Comma separated multiple titles create multiple tabs only with the form. + + + + + Set the terminal's working directory. + + + + + + Prints the program version, and exit. + + + + + + EXAMPLES, AND MORE DETAILS + + + + A hidden tab is created when , or any variant, is requested, with no more than one command, or no more than one tab, is specified. For example, + lxterminal --tabs= --no-remote + This hidden tab can be revealed when the lxterminal is running. For example, when requesting a new tab with the Shift+Ctrl+T combination keys. + + + +For display puposes, the command examples might be broken into more than one line. When actually using the examples, commands should be entered in a single line. Or have line breaks according to the usual shell conventions. + All command examples here use to avoid interaction with possibly running lxterminals. + + + + Consider + lxterminal --no-remote --command='/bin/bash -c "echo This window will be closed after you will press enter. ; read -p \"Do press the <enter> key.\" " ' + This example emphasizes a limitaion of running commands from the lxterminal command line. As a result, the feature to run a command from the lxterminal command line is much more useful for processes that exit by the user explicit request. Such as an interactive shell. A short lived process does work. Only that it is fast enough to make the window, or the tab, closed before the user can pay attention. For a short lived process, such as + lxterminal --no-remote --tabs=ls,"Midnight Commander" --command=ls --command=mc + , the user must have indirect means to inspect the outcome of the command, if he wishes to. Such as redirecting the output to a file. + + + + + lxterminal --no-remote --tabs='1st tab',"2nd tab" --tabs= --no-remote + In contrast to many other applications, repeating a command line is not an error. With some s, the right most occurence overrides previous ocuurences. But there are exceptions. The left most will always be executed in the 1st tab. Unless , or , was specified. As stated earlier, multiple are commulative in the sense that each will be executed. Just try out if it is a concern for you. The behaviour is deterministic. + + + + + The comma character, ',', is used as the separator for the titles to the option. + lxterminal --tabs="midnight commander,2nd tab" --command=mc --no-remote + There is no way to insert a comma character in the titles to be displayed by . The comma character can be used for the similar options for giving a title, such as . But these other options do not offer mutltiple tabs. + + + + + + AUTHOR + + This manual page was written by paulliu grandpaul@gmail.com for + the Debian system (but may be used by others). Permission is + granted to copy, distribute and/or modify this document under + the terms of the GNU General Public License, Version 2 any + later version published by the Free Software Foundation. + + On Debian systems, the complete text of the GNU General Public + License can be found in /usr/share/common-licenses/GPL. + + + + + FILES + + The configuration file can be found in ~/.config/lxterminal/lxterminal.conf. + +
From e0621ca13d60418b11be557ae2fb418f2eb636cb Mon Sep 17 00:00:00 2001 From: ZjYwMj <27451609+ZjYwMj@users.noreply.github.com> Date: Fri, 1 Oct 2021 16:18:44 +0000 Subject: [PATCH 5/6] Restore the -n command line option Restore the short option for --no-remote --- src/lxterminal.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lxterminal.c b/src/lxterminal.c index 49c62438..17126fb6 100644 --- a/src/lxterminal.c +++ b/src/lxterminal.c @@ -114,15 +114,15 @@ static gchar usage_display[] = { "Usage:\n" " lxterminal [Options...] - LXTerminal is a terminal emulator\n\n" "Options:\n" - " --command=STRING [--command=STRING [...]],\n" + " --command=[[STRING] [--command=[STRING] [...]]],\n" " -e STRING, --command STRING Execute the argument to this option inside the terminal\n" " --geometry=COLUMNSxROWS Set the terminal's size\n" " -h, --help This help text\n" " -l, --loginshell Execute login shell\n" " -t, -T, --title=,\n" - " --tabs=NAME[,NAME[,NAME[...]]] Set the terminal's title\n" + " --tabs=[NAME[,NAME[...]]] Set the terminal's title\n" " --working-directory=DIRECTORY Set the terminal's working directory\n" - " --no-remote Do not accept or send remote commands\n" + " -n, --no-remote Do not accept or send remote commands\n" " -v, --version Version information\n" }; @@ -1540,7 +1540,7 @@ gboolean lxterminal_process_arguments(gint argc, gchar * * argv, CommandArgument } /* --no-remote: Do not accept or send remote commands */ - else if (strcmp(argument, "--no-remote") == 0) { + else if ((strcmp(argument, "--no-remote") == 0) || (strcmp(argument, "-n") == 0)) { arguments->no_remote = TRUE; } From e9642e2d2cd7ef8fde01298415200d14fcae64dc Mon Sep 17 00:00:00 2001 From: ZjYwMj <27451609+ZjYwMj@users.noreply.github.com> Date: Fri, 1 Oct 2021 16:22:42 +0000 Subject: [PATCH 6/6] Update the description of -n in the manual page So that users will know the security implications. --- man/lxterminal.xml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/man/lxterminal.xml b/man/lxterminal.xml index 15b75a4b..8f40e957 100644 --- a/man/lxterminal.xml +++ b/man/lxterminal.xml @@ -40,10 +40,9 @@ options is included below. - + + - - These options specifies the program (and its command line arguments) to be run in the terminal. Except in the form, this must be the last option on the command line, since the following arguments, if there are any, will be considered related to the program to be run. Multiple options, each specify a single program (and its command line arguments), create multiple tabs, each running the respective program. New tabs will be created as necessary, after all the explictly requested will be exhausted. @@ -65,6 +64,13 @@ Executes login shell. + + + + Normally, LXTerminal uses a single controller for all of the LXTerminal windows of a user and host pair. The first LXTerminal to start, without this option stated on its command line, will act as the controller. Any subsequent LXTerminals, of that user on that host, will be a client of that controller. They will do no work of their own. If, for any reason, any LXTerminal, of the same user and host pair, will fail using that controller, it will fall back to running standalone; it will not be either the controller, or a client, of another LXTerminal. With this option stated in the command line, the created LXTerminal will act the same. It will run standalone; it will not be either the controller, or a client, of another LXTerminal. + + +