aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnders Rasmussen <divinegod@gmail.com>2017-02-14 13:22:59 +1100
committerJoe Wilm <jwilm@users.noreply.github.com>2017-02-14 08:53:18 -0800
commitc49d4a936553135f6326e91e62445a5e04186a80 (patch)
tree8cd0d6b595e23f543c36c8a5f85de99478796fe8
parent24c32dc4004d1c67fe95f418b7737ec393898208 (diff)
downloadalacritty-c49d4a936553135f6326e91e62445a5e04186a80.tar.gz
alacritty-c49d4a936553135f6326e91e62445a5e04186a80.zip
Add TERM config entry
-rw-r--r--alacritty.yml13
-rw-r--r--alacritty_macos.yml12
-rw-r--r--src/config.rs10
-rw-r--r--src/tty.rs5
4 files changed, 39 insertions, 1 deletions
diff --git a/alacritty.yml b/alacritty.yml
index 53541e59..ba44cf11 100644
--- a/alacritty.yml
+++ b/alacritty.yml
@@ -1,4 +1,17 @@
# Configuration for Alacritty, the GPU enhanced terminal emulator
+
+
+# Any items in the `env` entry below will be added as
+# environment variables. Some entries may override variables
+# set by alacritty it self.
+env:
+ # TERM env customization. Default is xterm-256color
+ # Note: the default TERM value `xterm-256color` does not
+ # specify all features alacritty supports. This does pose
+ # a few issues with programs relying on terminfo and the
+ # `tput` command
+ TERM: xterm-256color
+
# Window dimensions in character columns and lines
# (changes require restart)
dimensions:
diff --git a/alacritty_macos.yml b/alacritty_macos.yml
index 0d6e1eb6..98a0ee63 100644
--- a/alacritty_macos.yml
+++ b/alacritty_macos.yml
@@ -1,4 +1,16 @@
# Configuration for Alacritty, the GPU enhanced terminal emulator
+
+# Any items in the `env` entry below will be added as
+# environment variables. Some entries may override variables
+# set by alacritty it self.
+env:
+ # TERM env customization. Default is xterm-256color
+ # Note: the default TERM value `xterm-256color` does not
+ # specify all features alacritty supports. This does pose
+ # a few issues with programs relying on terminfo and the
+ # `tput` command
+ TERM: xterm-256color
+
# Window dimensions in character columns and lines
# (changes require restart)
dimensions:
diff --git a/src/config.rs b/src/config.rs
index fafb61c2..3be8e4c8 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -11,6 +11,7 @@ use std::path::{Path, PathBuf};
use std::str::FromStr;
use std::sync::mpsc;
use std::time::Duration;
+use std::collections::HashMap;
use ::Rgb;
use font::Size;
@@ -171,6 +172,10 @@ impl<'a> Shell<'a> {
/// Top-level config type
#[derive(Debug, Deserialize)]
pub struct Config {
+ /// TERM env variable
+ #[serde(default)]
+ env: HashMap<String, String>,
+
/// Initial dimensions
#[serde(default)]
dimensions: Dimensions,
@@ -267,6 +272,7 @@ impl Default for Config {
shell: None,
config_path: None,
visual_bell: Default::default(),
+ env: Default::default(),
}
}
}
@@ -998,6 +1004,10 @@ impl Config {
self.shell.as_ref()
}
+ pub fn env(&self) -> &HashMap<String, String> {
+ &self.env
+ }
+
fn load_from<P: Into<PathBuf>>(path: P) -> Result<Config> {
let path = path.into();
let raw = Config::read_file(path.as_path())?;
diff --git a/src/tty.rs b/src/tty.rs
index ca5fad78..39d3deea 100644
--- a/src/tty.rs
+++ b/src/tty.rs
@@ -207,7 +207,10 @@ pub fn new<T: ToWinsize>(config: &Config, options: &Options, size: T) -> Pty {
builder.env("USER", pw.name);
builder.env("SHELL", shell.program());
builder.env("HOME", pw.dir);
- builder.env("TERM", "xterm-256color"); // sigh
+ builder.env("TERM", "xterm-256color"); // default term until we can supply our own
+ for (key, value) in config.env().iter() {
+ builder.env(key, value);
+ }
builder.before_exec(move || {
// Create a new process group