fix: get display server in flatpak
This commit is contained in:
parent
9e75019d13
commit
162f29c80d
@ -43,7 +43,8 @@ pub fn get_display_server() -> String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn get_display_server_of_session(session: &str) -> String {
|
fn get_display_server_of_session(session: &str) -> String {
|
||||||
if let Ok(output) = run_loginctl(Some(vec!["show-session", "-p", "Type", session]))
|
let mut display_server = if let Ok(output) =
|
||||||
|
run_loginctl(Some(vec!["show-session", "-p", "Type", session]))
|
||||||
// Check session type of the session
|
// Check session type of the session
|
||||||
{
|
{
|
||||||
let display_server = String::from_utf8_lossy(&output.stdout)
|
let display_server = String::from_utf8_lossy(&output.stdout)
|
||||||
@ -76,16 +77,17 @@ fn get_display_server_of_session(session: &str) -> String {
|
|||||||
display_server
|
display_server
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// loginctl has not given the expected output. try something else.
|
"".to_owned()
|
||||||
if let Ok(sestype) = std::env::var("XDG_SESSION_TYPE") {
|
|
||||||
return sestype.to_owned();
|
|
||||||
}
|
|
||||||
// If the session is not a tty, then just return the type as usual
|
|
||||||
display_server
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
"".to_owned()
|
"".to_owned()
|
||||||
|
};
|
||||||
|
// loginctl has not given the expected output. try something else.
|
||||||
|
if let Ok(sestype) = std::env::var("XDG_SESSION_TYPE") {
|
||||||
|
display_server = sestype;
|
||||||
}
|
}
|
||||||
|
// If the session is not a tty, then just return the type as usual
|
||||||
|
display_server
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_values_of_seat0(indices: Vec<usize>) -> Vec<String> {
|
pub fn get_values_of_seat0(indices: Vec<usize>) -> Vec<String> {
|
||||||
@ -126,8 +128,7 @@ pub fn get_values_of_seat0(indices: Vec<usize>) -> Vec<String> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn is_active(sid: &str) -> bool {
|
fn is_active(sid: &str) -> bool {
|
||||||
if let Ok(output) = run_loginctl(Some(vec!["show-session", "-p", "State", sid]))
|
if let Ok(output) = run_loginctl(Some(vec!["show-session", "-p", "State", sid])) {
|
||||||
{
|
|
||||||
String::from_utf8_lossy(&output.stdout).contains("active")
|
String::from_utf8_lossy(&output.stdout).contains("active")
|
||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
|
Loading…
x
Reference in New Issue
Block a user