shell login

This commit is contained in:
Dongdong Zhou 2021-10-18 14:24:23 +01:00
parent a6badfd311
commit a6431cb75b
1 changed files with 7 additions and 1 deletions

View File

@ -9,10 +9,11 @@
use alacritty_terminal::{ use alacritty_terminal::{
ansi, ansi,
config::Program,
event::OnResize, event::OnResize,
event_loop::Msg, event_loop::Msg,
term::SizeInfo, term::SizeInfo,
tty::{self, EventedPty, EventedReadWrite}, tty::{self, setup_env, EventedPty, EventedReadWrite},
}; };
use mio::{ use mio::{
channel::{channel, Receiver, Sender}, channel::{channel, Receiver, Sender},
@ -68,6 +69,11 @@ pub fn new(
let poll = mio::Poll::new().unwrap(); let poll = mio::Poll::new().unwrap();
let mut config = TermConfig::default(); let mut config = TermConfig::default();
config.working_directory = cwd; config.working_directory = cwd;
config.shell = std::env::var("SHELL").ok().map(|shell| Program::WithArgs {
program: shell.to_string(),
args: vec!["-l".to_string()],
});
setup_env(&config);
let size = let size =
SizeInfo::new(width as f32, height as f32, 1.0, 1.0, 0.0, 0.0, true); SizeInfo::new(width as f32, height as f32, 1.0, 1.0, 0.0, 0.0, true);
let mut pty = alacritty_terminal::tty::new(&config, &size, None); let mut pty = alacritty_terminal::tty::new(&config, &size, None);