Skip to content
This repository has been archived by the owner on Nov 11, 2018. It is now read-only.

Commit

Permalink
Implement the ability to customise shell arguments via dconf.
Browse files Browse the repository at this point in the history
Added a shell-args key to implement the functionality outlined in
#100. To make your shell a login shell, simply set the
value of aforementioned key to the following:

    ['-l']
  • Loading branch information
LukeCarrier committed Jul 10, 2013
1 parent f8c8664 commit 3288fd8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
5 changes: 5 additions & 0 deletions data/org.gnome.finalterm.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@
<summary>Path to the shell executable which is to be run (NOTE: Only bash is currently supported)</summary>
<description></description>
</key>
<key type="as" name="shell-arguments">
<default>[]</default>
<summary>Options to pass to the shell executable</summary>
<description></description>
</key>
<key type="s" name="emulated-terminal">
<default>'xterm-256color'</default>
<summary>Value that the TERM environment variable will be set to (NOTE: Changing this variable may affect shell behavior)</summary>
Expand Down
5 changes: 5 additions & 0 deletions src/Settings.vala
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ public class Settings : Object {
set { settings.set_string("shell-path", value); }
}

public string[] shell_arguments {
owned get { return settings.get_strv("shell-arguments"); }
set { settings.set_strv("shell-arguments", value); }
}

public string emulated_terminal {
owned get { return settings.get_string("emulated-terminal"); }
set { settings.set_string("emulated-terminal", value); }
Expand Down
9 changes: 7 additions & 2 deletions src/Terminal.vala
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,14 @@ public class Terminal : Object {
private void run_shell() {
Environment.set_variable("TERM", Settings.get_default().emulated_terminal, true);

// Add custom shell arguments
string[] arguments = { Settings.get_default().shell_path, "--rcfile", Config.PKGDATADIR + "/Startup/bash_startup", "-i" };
foreach (var argument in Settings.get_default().shell_arguments) {
arguments += argument;
}

// Replace child process with shell process
Posix.execvp(Settings.get_default().shell_path,
{ Settings.get_default().shell_path, "--rcfile", Config.PKGDATADIR + "/Startup/bash_startup", "-i" });
Posix.execvp(Settings.get_default().shell_path, arguments);

// If this line is reached, execvp() must have failed
critical(_("execvp failed"));
Expand Down

0 comments on commit 3288fd8

Please sign in to comment.