Skip to content

Commit

Permalink
better linux support
Browse files Browse the repository at this point in the history
  • Loading branch information
rustdesk committed Jun 4, 2021
1 parent 31e6108 commit 1da5c1b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/platform/linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,9 @@ pub fn start_os_service() {
d = get_display();
}
if d.is_empty() {
d = ":0".to_owned()
d = ":0".to_owned();
}
d = d.replace(&whoami::hostname(), "").replace("localhost", "");
log::info!("DISPLAY: {}", d);
log::info!("XAUTHORITY: {}", auth);
std::env::set_var("XAUTHORITY", auth);
Expand Down Expand Up @@ -343,18 +344,24 @@ pub fn get_display_server() -> String {
pub fn is_login_wayland() -> bool {
if let Ok(contents) = std::fs::read_to_string("/etc/gdm3/custom.conf") {
contents.contains("#WaylandEnable=false")
} else if let Ok(contents) = std::fs::read_to_string("/etc/gdm/custom.conf") {
contents.contains("#WaylandEnable=false")
} else {
false
}
}

pub fn fix_login_wayland() {
let mut file = "/etc/gdm3/custom.conf".to_owned();
if !std::path::Path::new(&file).exists() {
file = "/etc/gdm/custom.conf".to_owned();
}
match std::process::Command::new("pkexec")
.args(vec![
"sed",
"-i",
"s/#WaylandEnable=false/WaylandEnable=false/g",
"/etc/gdm3/custom.conf",
&file
])
.output()
{
Expand Down

0 comments on commit 1da5c1b

Please sign in to comment.