Added session XDG env variables
This commit is contained in:
parent
ae34531d36
commit
c11fc482ef
|
@ -53,6 +53,7 @@ pub fn gather_sessions(user: &User) -> Vec<Session> {
|
||||||
false => vec![Session {
|
false => vec![Session {
|
||||||
name: String::from("Shell"),
|
name: String::from("Shell"),
|
||||||
generation: user.shell.to_str().unwrap().to_owned(),
|
generation: user.shell.to_str().unwrap().to_owned(),
|
||||||
|
env: vec![],
|
||||||
}],
|
}],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,15 +93,15 @@ fn gather_specialisations(path: &PathBuf) -> Vec<Session> {
|
||||||
|
|
||||||
fn gather_session_data(path: &PathBuf, reset_path: &PathBuf) -> Session {
|
fn gather_session_data(path: &PathBuf, reset_path: &PathBuf) -> Session {
|
||||||
let session_path = path.join("session");
|
let session_path = path.join("session");
|
||||||
|
let env_file = read_to_string(session_path.join("env")).unwrap();
|
||||||
|
|
||||||
let name = read_to_string(session_path.join("name")).unwrap();
|
let name = read_to_string(session_path.join("name")).unwrap();
|
||||||
// let init = format!(
|
|
||||||
// "sh -c \"{} && {} && {}\"",
|
|
||||||
// path.join("activate").display(),
|
|
||||||
// session_path.join("init").display(),
|
|
||||||
// reset_path.join("activate").display()
|
|
||||||
// );
|
|
||||||
let generation = path.to_str().unwrap().to_owned();
|
let generation = path.to_str().unwrap().to_owned();
|
||||||
|
let env = env_file.lines().map(String::from).collect();
|
||||||
|
|
||||||
Session { name, generation }
|
Session {
|
||||||
|
name,
|
||||||
|
generation,
|
||||||
|
env,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,10 +31,11 @@ pub fn login(
|
||||||
} else {
|
} else {
|
||||||
starting = true;
|
starting = true;
|
||||||
let cmd = vec![String::from("nixgreety session")];
|
let cmd = vec![String::from("nixgreety session")];
|
||||||
let env = vec![format!(
|
let mut env = vec![format!(
|
||||||
"NIXGREETY_GENERATION={}",
|
"NIXGREETY_GENERATION={}",
|
||||||
session.generation.clone()
|
session.generation.clone()
|
||||||
)];
|
)];
|
||||||
|
env.append(&mut session.env.clone());
|
||||||
Request::StartSession { cmd, env }.write_to(&mut stream)?;
|
Request::StartSession { cmd, env }.write_to(&mut stream)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,6 +128,7 @@ impl Display for User {
|
||||||
struct Session {
|
struct Session {
|
||||||
name: String,
|
name: String,
|
||||||
generation: String,
|
generation: String,
|
||||||
|
env: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Display for Session {
|
impl Display for Session {
|
||||||
|
|
Loading…
Reference in New Issue