mirror of
https://gitlab.com/gabmus/envision.git
synced 2025-08-02 14:18:49 +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::{
|
steam_linux_runtime_injector::{
|
||||||
restore_runtime_entrypoint, set_runtime_entrypoint_launch_opts_from_profile,
|
restore_runtime_entrypoint, set_runtime_entrypoint_launch_opts_from_profile,
|
||||||
},
|
},
|
||||||
|
termcolor::TermColor,
|
||||||
util::file_utils::{
|
util::file_utils::{
|
||||||
setcap_cap_sys_nice_eip, setcap_cap_sys_nice_eip_cmd, verify_cap_sys_nice_eip,
|
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() {
|
if dep_pkexec().check() {
|
||||||
self.setcap_confirm_dialog.present(Some(&self.app_win));
|
self.setcap_confirm_dialog.present(Some(&self.app_win));
|
||||||
} else {
|
} else {
|
||||||
|
self.build_window
|
||||||
|
.sender()
|
||||||
|
.emit(BuildWindowMsg::UpdateContent(vec![TermColor::Red
|
||||||
|
.colorize("pkexec not found, cannot set capabilities\n")]));
|
||||||
alert_w_widget(
|
alert_w_widget(
|
||||||
"pkexec not found",
|
"pkexec not found",
|
||||||
Some(&format!(
|
Some(&format!(
|
||||||
|
@ -734,6 +739,7 @@ impl AsyncComponent for App {
|
||||||
}
|
}
|
||||||
Msg::RunSetCap => {
|
Msg::RunSetCap => {
|
||||||
if !dep_pkexec().check() {
|
if !dep_pkexec().check() {
|
||||||
|
// there's a precheck ahead of this, this should likely never happen
|
||||||
error!("pkexec not found, skipping setcap");
|
error!("pkexec not found, skipping setcap");
|
||||||
} else {
|
} else {
|
||||||
let profile = self.get_selected_profile();
|
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 {
|
if let Err(e) = setcap_cap_sys_nice_eip(&profile).await {
|
||||||
setcap_failed_dialog();
|
setcap_failed_dialog();
|
||||||
error!("failed running setcap: {e}");
|
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 {
|
} else if !verify_cap_sys_nice_eip(&profile).await {
|
||||||
setcap_failed_dialog();
|
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 super::{term_widget::TermWidget, SENDER_IO_ERR_MSG};
|
||||||
use adw::prelude::*;
|
use adw::prelude::*;
|
||||||
use relm4::prelude::*;
|
use relm4::prelude::*;
|
||||||
|
@ -164,8 +166,18 @@ impl SimpleComponent for BuildWindow {
|
||||||
label.remove_css_class("success");
|
label.remove_css_class("success");
|
||||||
label.remove_css_class("error");
|
label.remove_css_class("error");
|
||||||
match status {
|
match status {
|
||||||
BuildStatus::Done => label.add_css_class("success"),
|
BuildStatus::Done => {
|
||||||
BuildStatus::Error(_) => label.add_css_class("error"),
|
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 {
|
if status != BuildStatus::Building {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue