get values of seat0, do not filter gdm

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou
2023-03-30 16:17:24 +08:00
parent 9ef4f4c1de
commit 34c3615320
4 changed files with 40 additions and 13 deletions

View File

@@ -357,6 +357,7 @@ pub fn start_os_service() {
&mut last_restart,
&mut user_server,
) {
stop_xorg_subprocess();
force_stop_server();
start_server(
Some((desktop.uid.clone(), desktop.username.clone())),
@@ -402,6 +403,12 @@ pub fn get_active_userid() -> String {
get_values_of_seat0(&[1])[0].clone()
}
#[inline]
pub fn is_gdm_user(username: &str) -> bool {
username == "gdm"
// || username == "lightgdm"
}
fn get_cm() -> bool {
if let Ok(output) = Command::new("ps").args(vec!["aux"]).output() {
for line in String::from_utf8_lossy(&output.stdout).lines() {
@@ -800,6 +807,11 @@ mod desktop {
self.sid.is_empty()
}
#[inline]
pub fn is_login_wayland(&self) -> bool {
super::is_gdm_user(&self.username) && self.protocal == ENV_DESKTOP_PROTOCAL_WAYLAND
}
#[inline]
pub fn is_headless(&self) -> bool {
self.sid.is_empty() || self.is_rustdesk_subprocess