opt: add display server check

This commit is contained in:
Kingtous 2022-12-08 17:43:46 +08:00
parent 7dadf3ba2f
commit 3cfcaf65ad

View File

@ -82,10 +82,12 @@ fn get_display_server_of_session(session: &str) -> String {
} else { } else {
"".to_owned() "".to_owned()
}; };
if display_server.is_empty() {
// loginctl has not given the expected output. try something else. // loginctl has not given the expected output. try something else.
if let Ok(sestype) = std::env::var("XDG_SESSION_TYPE") { if let Ok(sestype) = std::env::var("XDG_SESSION_TYPE") {
display_server = sestype; display_server = sestype;
} }
}
// If the session is not a tty, then just return the type as usual // If the session is not a tty, then just return the type as usual
display_server display_server
} }