From ee3ac310833ddc447e3e0e293d44286088550bba Mon Sep 17 00:00:00 2001 From: fufesou Date: Fri, 31 Mar 2023 10:25:58 +0800 Subject: [PATCH] add deps libpam0g-dev Signed-off-by: fufesou --- .github/workflows/flutter-nightly.yml | 2 +- libs/hbb_common/src/platform/linux.rs | 30 +++++---------------------- 2 files changed, 6 insertions(+), 26 deletions(-) diff --git a/.github/workflows/flutter-nightly.yml b/.github/workflows/flutter-nightly.yml index ab625e431..5aa82b847 100644 --- a/.github/workflows/flutter-nightly.yml +++ b/.github/workflows/flutter-nightly.yml @@ -11,4 +11,4 @@ jobs: uses: ./.github/workflows/flutter-build.yml with: upload-artifact: true - \ No newline at end of file + diff --git a/libs/hbb_common/src/platform/linux.rs b/libs/hbb_common/src/platform/linux.rs index ce0782a61..89c96799d 100644 --- a/libs/hbb_common/src/platform/linux.rs +++ b/libs/hbb_common/src/platform/linux.rs @@ -35,7 +35,6 @@ pub fn is_gdm_user(username: &str) -> bool { // || username == "lightgdm" } -<<<<<<< HEAD #[inline] pub fn is_desktop_wayland() -> bool { get_display_server() == DISPLAY_SERVER_WAYLAND @@ -44,26 +43,13 @@ pub fn is_desktop_wayland() -> bool { #[inline] pub fn is_x11_or_headless() -> bool { !is_desktop_wayland() -======= -pub fn is_x11_or_headless() -> bool { - let (username, display_server) = get_user_and_display_server(); - display_server == DISPLAY_SERVER_WAYLAND && is_gdm_user(&username) - || display_server != DISPLAY_SERVER_WAYLAND -} - -pub fn is_desktop_wayland() -> bool { - let (username, display_server) = get_user_and_display_server(); - display_server == DISPLAY_SERVER_WAYLAND && !is_gdm_user(&username) ->>>>>>> temp commit } // -1 const INVALID_SESSION: &str = "4294967295"; -pub fn get_user_and_display_server() -> (String, String) { - let seat0_values = get_values_of_seat0(&[0, 2]); - let mut session = seat0_values[0].clone(); - let username = seat0_values[1].clone(); +pub fn get_display_server() -> String { + let mut session = get_values_of_seat0(&[0])[0].clone(); if session.is_empty() { // loginctl has not given the expected output. try something else. if let Ok(sid) = std::env::var("XDG_SESSION_ID") { @@ -77,17 +63,11 @@ pub fn get_user_and_display_server() -> (String, String) { } } } -<<<<<<< HEAD if session.is_empty() { -======= - - let display_server = if session.is_empty() { ->>>>>>> temp commit "".to_owned() } else { get_display_server_of_session(&session) - }; - (username, display_server) + } } pub fn get_display_server_of_session(session: &str) -> String { @@ -211,7 +191,7 @@ pub fn run_cmds(cmds: &str) -> ResultType { } #[cfg(not(feature = "flatpak"))] -pub(super) fn run_loginctl(args: Option>) -> std::io::Result { +fn run_loginctl(args: Option>) -> std::io::Result { let mut cmd = std::process::Command::new("loginctl"); if let Some(a) = args { return cmd.args(a).output(); @@ -220,7 +200,7 @@ pub(super) fn run_loginctl(args: Option>) -> std::io::Result>) -> std::io::Result { +fn run_loginctl(args: Option>) -> std::io::Result { let mut l_args = String::from("loginctl"); if let Some(a) = args { l_args = format!("{} {}", l_args, a.join(" "));