mirror of
https://github.com/apognu/tuigreet.git
synced 2024-09-11 07:25:29 +03:00
Fixed bug where selecting a session from the menu would not execute the right command.
This commit is contained in:
parent
fe587635f5
commit
6426cd597b
@ -157,6 +157,10 @@ pub fn delete_last_user_session_path(username: &str) {
|
||||
let _ = fs::remove_file(format!("{LAST_SESSION_PATH}-{username}"));
|
||||
}
|
||||
|
||||
pub fn delete_last_user_session(username: &str) {
|
||||
let _ = fs::remove_file(&format!("{LAST_SESSION}-{username}"));
|
||||
}
|
||||
|
||||
pub fn get_users(min_uid: u16, max_uid: u16) -> Vec<User> {
|
||||
match File::open("/etc/passwd") {
|
||||
Err(_) => vec![],
|
||||
|
@ -7,7 +7,7 @@ use tokio::sync::{
|
||||
};
|
||||
|
||||
use crate::{
|
||||
info::{delete_last_user_session_path, write_last_user_session, write_last_user_session_path, write_last_username},
|
||||
info::{delete_last_user_session, delete_last_user_session_path, write_last_user_session, write_last_user_session_path, write_last_username},
|
||||
ui::sessions::{Session, SessionSource, SessionType},
|
||||
AuthStatus, Greeter, Mode,
|
||||
};
|
||||
@ -116,6 +116,7 @@ impl Ipc {
|
||||
SessionSource::Session(index) => {
|
||||
if let Some(Session { path: Some(session_path), .. }) = greeter.sessions.options.get(index) {
|
||||
write_last_user_session_path(&greeter.username, session_path);
|
||||
delete_last_user_session(&greeter.username);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,12 +37,7 @@ impl SessionSource {
|
||||
match self {
|
||||
SessionSource::None => None,
|
||||
SessionSource::Command(command) => Some(command.as_str()),
|
||||
SessionSource::Session(index) => greeter
|
||||
.sessions
|
||||
.options
|
||||
.get(*index)
|
||||
.and_then(|session| session.path.as_ref())
|
||||
.and_then(|path| path.as_os_str().to_str()),
|
||||
SessionSource::Session(index) => greeter.sessions.options.get(*index).map(|session| session.command.as_str()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user