From cd33a8abbdd0d61259dc6840bcd0c2a8902a818e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sapphire=20=C2=AD?= Date: Sat, 19 Oct 2024 15:33:19 +0000 Subject: [PATCH] fix: setcap wivrn-server --- src/ui/app.rs | 28 +++++++++++++--------------- src/util/file_utils.rs | 3 +-- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/src/ui/app.rs b/src/ui/app.rs index 5e2da92..607597b 100644 --- a/src/ui/app.rs +++ b/src/ui/app.rs @@ -533,21 +533,19 @@ impl AsyncComponent for App { .sender() .emit(BuildWindowMsg::UpdateBuildStatus(BuildStatus::Done)); let profile = self.get_selected_profile(); - if profile.xrservice_type == XRServiceType::Monado { - if dep_pkexec().check() { - self.setcap_confirm_dialog.present(Some(&self.app_win)); - } else { - alert_w_widget( - "pkexec not found", - Some(&format!( - "The build is complete, but we need to set certain capabilities (CAP_SYS_NICE=eip) on the OpenXR server executable.\n\n{APP_NAME} can do that using pkexec, but it doesn't seem to be installed on your system.\n\nYou can do this step on your own by running the following command:" - )), - Some(&copiable_code_snippet( - &format!("sudo {}", setcap_cap_sys_nice_eip_cmd(&profile).join(" ")) - )), - Some(&self.app_win.clone().upcast()) - ); - } + if dep_pkexec().check() { + self.setcap_confirm_dialog.present(Some(&self.app_win)); + } else { + alert_w_widget( + "pkexec not found", + Some(&format!( + "The build is complete, but we need to set certain capabilities (CAP_SYS_NICE=eip) on the OpenXR server executable.\n\n{APP_NAME} can do that using pkexec, but it doesn't seem to be installed on your system.\n\nYou can do this step on your own by running the following command:" + )), + Some(&copiable_code_snippet( + &format!("sudo {}", setcap_cap_sys_nice_eip_cmd(&profile).join(" ")) + )), + Some(&self.app_win.clone().upcast()) + ); } self.build_window .sender() diff --git a/src/util/file_utils.rs b/src/util/file_utils.rs index 3c927ac..e05a7ac 100644 --- a/src/util/file_utils.rs +++ b/src/util/file_utils.rs @@ -74,8 +74,7 @@ pub fn setcap_cap_sys_nice_eip_cmd(profile: &Profile) -> Vec { "CAP_SYS_NICE=eip".into(), profile .prefix - // not needed for wivrn, that's why monado is hardcoded - .join("bin/monado-service") + .join(profile.xrservice_binary()) .to_string_lossy() .to_string(), ]