sync rustdesk's hbb_common here

This commit is contained in:
rustdesk
2023-01-27 11:00:59 +08:00
parent 2314783d42
commit 17ddc89bd0
7 changed files with 192 additions and 16 deletions

View File

@@ -1,15 +1,15 @@
use crate::ResultType;
lazy_static::lazy_static! {
pub static ref DISTRO: Disto = Disto::new();
pub static ref DISTRO: Distro = Distro::new();
}
pub struct Disto {
pub struct Distro {
pub name: String,
pub version_id: String,
}
impl Disto {
impl Distro {
fn new() -> Self {
let name = run_cmds("awk -F'=' '/^NAME=/ {print $2}' /etc/os-release".to_owned())
.unwrap_or_default()
@@ -74,7 +74,7 @@ fn get_display_server_of_session(session: &str) -> String {
} else {
"".to_owned()
};
if display_server.is_empty() {
if display_server.is_empty() || display_server == "tty" {
// loginctl has not given the expected output. try something else.
if let Ok(sestype) = std::env::var("XDG_SESSION_TYPE") {
display_server = sestype;