diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/lib.rs | 1 | ||||
-rw-r--r-- | src/tty.rs | 13 |
2 files changed, 13 insertions, 1 deletions
@@ -50,6 +50,7 @@ extern crate unicode_width; extern crate vte; extern crate xdg; extern crate base64; +extern crate terminfo; #[macro_use] pub mod macros; @@ -22,12 +22,14 @@ use std::ptr; use std::process::{Command, Stdio}; use libc::{self, winsize, c_int, pid_t, WNOHANG, SIGCHLD, TIOCSCTTY}; +use terminfo::Database; use term::SizeInfo; use display::OnResize; use config::{Config, Shell}; use cli::Options; + /// Process ID of child process /// /// Necessary to put this in static storage for `sigchld` to have access @@ -210,7 +212,16 @@ pub fn new<T: ToWinsize>(config: &Config, options: &Options, size: &T, window_id builder.env("USER", pw.name); builder.env("SHELL", shell.program()); builder.env("HOME", pw.dir); - builder.env("TERM", "xterm-256color"); // default term until we can supply our own + + // TERM; default to 'alacritty' if it is available, otherwise + // default to 'xterm-256color'. May be overridden by user's config + // below. + let mut term = "alacritty"; + if let Err(_) = Database::from_name("alacritty") { + term = "xterm-256color"; + } + builder.env("TERM", term); + builder.env("COLORTERM", "truecolor"); // advertise 24-bit support if let Some(window_id) = window_id { builder.env("WINDOWID", format!("{}", window_id)); |