Remove wayland fix for good
Signed-off-by: simonspa <simonspa@kth.se>
This commit is contained in:
parent
32760ba00c
commit
6db94983a1
@ -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") {
|
||||
|
10
src/ui.rs
10
src/ui.rs
@ -434,18 +434,10 @@ impl UI {
|
||||
is_login_wayland()
|
||||
}
|
||||
|
||||
fn fix_login_wayland(&mut self) {
|
||||
fix_login_wayland()
|
||||
}
|
||||
|
||||
fn current_is_wayland(&mut self) -> bool {
|
||||
current_is_wayland()
|
||||
}
|
||||
|
||||
fn modify_default_login(&mut self) -> String {
|
||||
modify_default_login()
|
||||
}
|
||||
|
||||
fn get_software_update_url(&self) -> String {
|
||||
get_software_update_url()
|
||||
}
|
||||
@ -590,9 +582,7 @@ impl sciter::EventHandler for UI {
|
||||
fn is_installed_daemon(bool);
|
||||
fn get_error();
|
||||
fn is_login_wayland();
|
||||
fn fix_login_wayland();
|
||||
fn current_is_wayland();
|
||||
fn modify_default_login();
|
||||
fn get_options();
|
||||
fn get_option(String);
|
||||
fn get_local_option(String);
|
||||
|
@ -755,11 +755,6 @@ class FixWayland: Reactor.Component {
|
||||
</div>;
|
||||
}
|
||||
|
||||
event click $(#fix-wayland) {
|
||||
handler.fix_login_wayland();
|
||||
app.update();
|
||||
}
|
||||
|
||||
event click $(#help-me) {
|
||||
handler.open_url(translate("doc_fix_wayland"));
|
||||
}
|
||||
@ -774,14 +769,6 @@ class ModifyDefaultLogin: Reactor.Component {
|
||||
</div>;
|
||||
}
|
||||
|
||||
event click $(#modify-default-login) {
|
||||
if (var r = handler.modify_default_login()) {
|
||||
// without handler, will fail, fucking stupid sciter
|
||||
handler.msgbox("custom-error", "Error", r);
|
||||
}
|
||||
app.update();
|
||||
}
|
||||
|
||||
event click $(#help-me) {
|
||||
handler.open_url(translate("doc_fix_wayland"));
|
||||
}
|
||||
|
@ -614,12 +614,6 @@ pub fn is_login_wayland() -> bool {
|
||||
return false;
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn fix_login_wayland() {
|
||||
#[cfg(target_os = "linux")]
|
||||
crate::platform::linux::fix_login_wayland();
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn current_is_wayland() -> bool {
|
||||
#[cfg(target_os = "linux")]
|
||||
@ -628,14 +622,6 @@ pub fn current_is_wayland() -> bool {
|
||||
return false;
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn modify_default_login() -> String {
|
||||
#[cfg(target_os = "linux")]
|
||||
return crate::platform::linux::modify_default_login();
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
return "".to_owned();
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn get_software_update_url() -> String {
|
||||
SOFTWARE_UPDATE_URL.lock().unwrap().clone()
|
||||
|
Loading…
x
Reference in New Issue
Block a user