mirror of
https://gitlab.com/gabmus/envision.git
synced 2025-07-29 20:28:48 +00:00
feat: add some messages related to setcap output to build window; add build completed message to build window
This commit is contained in:
parent
bd0cc9e2b1
commit
8f3f9b8759
2 changed files with 38 additions and 2 deletions
|
@ -43,6 +43,7 @@ use crate::{
|
|||
steam_linux_runtime_injector::{
|
||||
restore_runtime_entrypoint, set_runtime_entrypoint_launch_opts_from_profile,
|
||||
},
|
||||
termcolor::TermColor,
|
||||
util::file_utils::{
|
||||
setcap_cap_sys_nice_eip, setcap_cap_sys_nice_eip_cmd, verify_cap_sys_nice_eip,
|
||||
},
|
||||
|
@ -653,6 +654,10 @@ impl AsyncComponent for App {
|
|||
if dep_pkexec().check() {
|
||||
self.setcap_confirm_dialog.present(Some(&self.app_win));
|
||||
} else {
|
||||
self.build_window
|
||||
.sender()
|
||||
.emit(BuildWindowMsg::UpdateContent(vec![TermColor::Red
|
||||
.colorize("pkexec not found, cannot set capabilities\n")]));
|
||||
alert_w_widget(
|
||||
"pkexec not found",
|
||||
Some(&format!(
|
||||
|
@ -734,6 +739,7 @@ impl AsyncComponent for App {
|
|||
}
|
||||
Msg::RunSetCap => {
|
||||
if !dep_pkexec().check() {
|
||||
// there's a precheck ahead of this, this should likely never happen
|
||||
error!("pkexec not found, skipping setcap");
|
||||
} else {
|
||||
let profile = self.get_selected_profile();
|
||||
|
@ -751,8 +757,26 @@ impl AsyncComponent for App {
|
|||
if let Err(e) = setcap_cap_sys_nice_eip(&profile).await {
|
||||
setcap_failed_dialog();
|
||||
error!("failed running setcap: {e}");
|
||||
self.build_window
|
||||
.sender()
|
||||
.emit(BuildWindowMsg::UpdateContent(vec![
|
||||
TermColor::Red.colorize("Setting capabilities failed\n")
|
||||
]));
|
||||
} else if !verify_cap_sys_nice_eip(&profile).await {
|
||||
setcap_failed_dialog();
|
||||
error!("setcap succeeded but capabilities were reset");
|
||||
self.build_window
|
||||
.sender()
|
||||
.emit(BuildWindowMsg::UpdateContent(vec![TermColor::Red
|
||||
.colorize(
|
||||
"Setting capabilities succeeded, but capabilities have been reset\n",
|
||||
)]));
|
||||
} else {
|
||||
self.build_window
|
||||
.sender()
|
||||
.emit(BuildWindowMsg::UpdateContent(vec![
|
||||
TermColor::Green.colorize("Capabilities set correctly\n")
|
||||
]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
use crate::termcolor::TermColor;
|
||||
|
||||
use super::{term_widget::TermWidget, SENDER_IO_ERR_MSG};
|
||||
use adw::prelude::*;
|
||||
use relm4::prelude::*;
|
||||
|
@ -164,8 +166,18 @@ impl SimpleComponent for BuildWindow {
|
|||
label.remove_css_class("success");
|
||||
label.remove_css_class("error");
|
||||
match status {
|
||||
BuildStatus::Done => label.add_css_class("success"),
|
||||
BuildStatus::Error(_) => label.add_css_class("error"),
|
||||
BuildStatus::Done => {
|
||||
label.add_css_class("success");
|
||||
sender.input(BuildWindowMsg::UpdateContent(vec![
|
||||
TermColor::Blue.colorize("Build completed!\n")
|
||||
]));
|
||||
}
|
||||
BuildStatus::Error(_) => {
|
||||
label.add_css_class("error");
|
||||
sender.input(BuildWindowMsg::UpdateContent(vec![
|
||||
TermColor::Blue.colorize("Build failed!\n")
|
||||
]));
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
if status != BuildStatus::Building {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue