diff --git a/ChangeLog b/ChangeLog index a9134869..f4f4a659 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-04-19 Enrico Tröger + + * doc/geany.docbook, src/vte.c: + Fixed handling of command line arguments within the shell command for + the VTE to enable use of shells as login shells. + + 2007-04-18 Nick Treleaven * doc/geany.docbook: diff --git a/doc/geany.docbook b/doc/geany.docbook index 0c980c05..aae36fe7 100644 --- a/doc/geany.docbook +++ b/doc/geany.docbook @@ -394,6 +394,12 @@ pressing the middle mouse button in the VTE (on 2-button mice, the middle button can often be simulated by pressing both mouse buttons together). + + In the preferences dialog you can specify a shell which should be started in the + VTE. To make the specified shell a login shell just use the appropriate command + line options for the shell. These options should be found in the manual page of + the shell. For zsh and bash you can use the argument --login. + Geany tries to load libvte.so. If this fails, it tries to load libvte.so.4. If this diff --git a/src/vte.c b/src/vte.c index 8c4a049d..5fa73b68 100644 --- a/src/vte.c +++ b/src/vte.c @@ -233,8 +233,11 @@ static gboolean vte_keypress(GtkWidget *widget, GdkEventKey *event, gpointer dat { vte_get_working_directory(); // try to keep the working directory when restarting the VTE - kill(pid, SIGINT); - pid = 0; + if (pid > 0) + { + kill(pid, SIGINT); + pid = 0; + } vf->vte_terminal_reset(VTE_TERMINAL(widget), TRUE, TRUE); vte_start(widget); @@ -249,11 +252,21 @@ static void vte_start(GtkWidget *widget) { VteTerminal *vte = VTE_TERMINAL(widget); gchar **env; + gchar **argv; - env = vte_get_child_environment(); - pid = vf->vte_terminal_fork_command(VTE_TERMINAL(vte), vc->shell, NULL, env, + // split the shell command line, so arguments will work too + argv = g_strsplit(vc->shell, " ", -1); + + if (argv != NULL) + { + env = vte_get_child_environment(); + pid = vf->vte_terminal_fork_command(VTE_TERMINAL(vte), argv[0], argv, env, vte_info.dir, TRUE, TRUE, TRUE); - g_strfreev(env); + g_strfreev(env); + g_strfreev(argv); + } + else + pid = 0; // use 0 as invalid pid } @@ -405,7 +418,7 @@ const gchar* vte_get_working_directory() gchar *cwd; gint length; - if (pid >= 0) + if (pid > 0) { file = g_strdup_printf("/proc/%d/cwd", pid); length = readlink(file, buffer, sizeof (buffer));