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 { | ||||
|             name: String::from("Shell"), | ||||
|             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 { | ||||
|     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 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 env = env_file.lines().map(String::from).collect(); | ||||
| 
 | ||||
|     Session { name, generation } | ||||
|     Session { | ||||
|         name, | ||||
|         generation, | ||||
|         env, | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -31,10 +31,11 @@ pub fn login( | ||||
|                 } else { | ||||
|                     starting = true; | ||||
|                     let cmd = vec![String::from("nixgreety session")]; | ||||
|                     let env = vec![format!( | ||||
|                     let mut env = vec![format!( | ||||
|                         "NIXGREETY_GENERATION={}", | ||||
|                         session.generation.clone() | ||||
|                     )]; | ||||
|                     env.append(&mut session.env.clone()); | ||||
|                     Request::StartSession { cmd, env }.write_to(&mut stream)?; | ||||
|                 } | ||||
|             } | ||||
|  | ||||
| @ -128,6 +128,7 @@ impl Display for User { | ||||
| struct Session { | ||||
|     name: String, | ||||
|     generation: String, | ||||
|     env: Vec<String>, | ||||
| } | ||||
| 
 | ||||
| impl Display for Session { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Jan-Bulthuis
						Jan-Bulthuis