diff options
author | Kirill Chibisov <contact@kchibisov.com> | 2023-11-10 18:16:22 +0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-10 18:16:22 +0400 |
commit | 5060f8eeb864e8c304fbad9588bdd882db942356 (patch) | |
tree | b615ded19e6ac545b495f716e2a22ecd903332af /alacritty_terminal/src/tty/mod.rs | |
parent | 3ffd6c8f26f9788466b9ba95659b8de970a10f08 (diff) | |
download | r-alacritty-5060f8eeb864e8c304fbad9588bdd882db942356.tar.gz r-alacritty-5060f8eeb864e8c304fbad9588bdd882db942356.tar.bz2 r-alacritty-5060f8eeb864e8c304fbad9588bdd882db942356.zip |
Remove `alacritty_config` from alacritty_terminal
There's no need to force alacritty's user configuration on
other users of the crate, thus provide the options actually used
by alacritty_terminal itself.
Diffstat (limited to 'alacritty_terminal/src/tty/mod.rs')
-rw-r--r-- | alacritty_terminal/src/tty/mod.rs | 41 |
1 files changed, 32 insertions, 9 deletions
diff --git a/alacritty_terminal/src/tty/mod.rs b/alacritty_terminal/src/tty/mod.rs index 315f008c..d1bb023c 100644 --- a/alacritty_terminal/src/tty/mod.rs +++ b/alacritty_terminal/src/tty/mod.rs @@ -4,8 +4,6 @@ use std::path::PathBuf; use std::sync::Arc; use std::{env, io}; -use crate::config::Config; - use polling::{Event, PollMode, Poller}; #[cfg(not(windows))] @@ -18,8 +16,38 @@ pub mod windows; #[cfg(windows)] pub use self::windows::*; +/// Configuration for the `Pty` interface. +#[derive(Clone, Debug, PartialEq, Eq, Default)] +pub struct Options { + /// Shell options. + /// + /// [`None`] will use the default shell. + pub shell: Option<Shell>, + + /// Shell startup directory. + pub working_directory: Option<PathBuf>, + + /// Remain open after child process exits. + pub hold: bool, +} + +/// Shell options. +#[derive(Clone, Debug, PartialEq, Eq, Default)] +pub struct Shell { + /// Path to a shell program to run on startup. + pub(crate) program: String, + /// Arguments passed to shell. + pub(crate) args: Vec<String>, +} + +impl Shell { + pub fn new(program: String, args: Vec<String>) -> Self { + Self { program, args } + } +} + /// This trait defines the behaviour needed to read and/or write to a stream. -/// It defines an abstraction over mio's interface in order to allow either one +/// It defines an abstraction over polling's interface in order to allow either one /// read/write object or a separate read and write object. pub trait EventedReadWrite { type Reader: io::Read; @@ -56,7 +84,7 @@ pub trait EventedPty: EventedReadWrite { } /// Setup environment variables. -pub fn setup_env(config: &Config) { +pub fn setup_env() { // Default to 'alacritty' terminfo if it is available, otherwise // default to 'xterm-256color'. May be overridden by user's config // below. @@ -69,11 +97,6 @@ pub fn setup_env(config: &Config) { // Prevent child processes from inheriting startup notification env. env::remove_var("DESKTOP_STARTUP_ID"); env::remove_var("XDG_ACTIVATION_TOKEN"); - - // Set env vars from config. - for (key, value) in config.env.iter() { - env::set_var(key, value); - } } /// Check if a terminfo entry exists on the system. |