Remove wayland fix for good

Signed-off-by: simonspa <simonspa@kth.se>
This commit is contained in:
Simon Spannagel
2023-01-30 08:06:48 +01:00
parent 32760ba00c
commit 6db94983a1
4 changed files with 0 additions and 130 deletions

View File

@@ -426,104 +426,11 @@ pub fn is_login_wayland() -> bool {
}
}
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",
&file,
])
.output()
{
Ok(x) => {
let x = String::from_utf8_lossy(&x.stderr);
if !x.is_empty() {
log::error!("fix_login_wayland failed: {}", x);
}
}
Err(err) => {
log::error!("fix_login_wayland failed: {}", err);
}
}
}
pub fn current_is_wayland() -> bool {
let dtype = get_display_server();
return "wayland" == dtype && unsafe { UNMODIFIED };
}
pub fn modify_default_login() -> String {
let dsession = std::env::var("DESKTOP_SESSION").unwrap();
let user_name = std::env::var("USERNAME").unwrap();
if let Ok(x) = run_cmds("ls /usr/share/* | grep ${DESKTOP_SESSION}-xorg.desktop".to_owned()) {
if x.trim_end().to_string() != "" {
match std::process::Command::new("pkexec")
.args(vec![
"sed",
"-i",
&format!("s/={0}$/={0}-xorg/g", &dsession),
&format!("/var/lib/AccountsService/users/{}", &user_name),
])
.output()
{
Ok(x) => {
let x = String::from_utf8_lossy(&x.stderr);
if !x.is_empty() {
log::error!("modify_default_login failed: {}", x);
return "Fix failed! Please re-login with X server manually".to_owned();
} else {
unsafe {
UNMODIFIED = false;
}
return "".to_owned();
}
}
Err(err) => {
log::error!("modify_default_login failed: {}", err);
return "Fix failed! Please re-login with X server manually".to_owned();
}
}
} else if let Ok(z) =
run_cmds("ls /usr/share/* | grep ${DESKTOP_SESSION:0:-8}.desktop".to_owned())
{
if z.trim_end().to_string() != "" {
match std::process::Command::new("pkexec")
.args(vec![
"sed",
"-i",
&format!("s/={}$/={}/g", &dsession, &dsession[..dsession.len() - 8]),
&format!("/var/lib/AccountsService/users/{}", &user_name),
])
.output()
{
Ok(x) => {
let x = String::from_utf8_lossy(&x.stderr);
if !x.is_empty() {
log::error!("modify_default_login failed: {}", x);
return "Fix failed! Please re-login with X server manually".to_owned();
} else {
unsafe {
UNMODIFIED = false;
}
return "".to_owned();
}
}
Err(err) => {
log::error!("modify_default_login failed: {}", err);
return "Fix failed! Please re-login with X server manually".to_owned();
}
}
}
}
}
return "Fix failed! Please re-login with X server manually".to_owned();
}
// to-do: test the other display manager
fn _get_display_manager() -> String {
if let Ok(x) = std::fs::read_to_string("/etc/X11/default-display-manager") {