Compare commits
4 Commits
1ae8580deb
...
f113ee79bf
Author | SHA1 | Date |
---|---|---|
mars | f113ee79bf | |
lilith | 08f4125fff | |
lilith | 16595a6c20 | |
lilith | 2e3a8a52f7 |
|
@ -48,12 +48,18 @@ pub struct FontConfig {
|
|||
pub bold: PathBuf,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Deserialize, Serialize)]
|
||||
pub struct SystemConfig {
|
||||
pub shell: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Deserialize, Serialize)]
|
||||
pub struct Config {
|
||||
pub cursor: CursorConfig,
|
||||
pub colors: ColorConfig,
|
||||
pub draw: DrawConfig,
|
||||
pub fonts: FontConfig,
|
||||
pub system: SystemConfig,
|
||||
}
|
||||
|
||||
impl Default for CursorConfig {
|
||||
|
|
17
src/main.rs
17
src/main.rs
|
@ -42,6 +42,19 @@ impl EventListener for TermListener {
|
|||
}
|
||||
}
|
||||
|
||||
fn get_login_shell(config: Config) -> String {
|
||||
if config.system.shell != "" {
|
||||
config.system.shell
|
||||
} else {
|
||||
match std::env::consts::OS {
|
||||
"linux" | "openbsd" | "netbsd" | "dragonfly" | "solaris" | "macos" =>
|
||||
std::env::var("SHELL").unwrap_or("/bin/sh".to_string()),
|
||||
"windows" => r#"C:\Windows\System32\cmd.exe"#.to_string(),
|
||||
_ => unimplemented!("Unrecognized operating system; cannot get user's shell")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct App {
|
||||
graphics: Graphics,
|
||||
graphics_context: GraphicsContext<Window>,
|
||||
|
@ -70,9 +83,7 @@ impl App {
|
|||
|
||||
let term_config = alacritty_terminal::config::Config {
|
||||
pty_config: PtyConfig {
|
||||
shell: Some(alacritty_terminal::config::Program::Just(
|
||||
"/usr/bin/fish".to_string(),
|
||||
)),
|
||||
shell: Some(alacritty_terminal::config::Program::Just(get_login_shell(config))),
|
||||
working_directory: None,
|
||||
hold: false,
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue