mirror of
https://gitlab.com/gabmus/envision.git
synced 2025-09-20 08:18:37 +00:00
feat: button to launch monado-gui
This commit is contained in:
parent
e172090757
commit
32b222cd9e
3 changed files with 58 additions and 0 deletions
|
@ -689,6 +689,19 @@ impl Profile {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn monado_gui_binary(&self) -> Option<PathBuf> {
|
||||||
|
if self.xrservice_type != XRServiceType::Monado {
|
||||||
|
None
|
||||||
|
} else {
|
||||||
|
let p = self.prefix.join("bin").join("monado-gui");
|
||||||
|
if p.is_file() {
|
||||||
|
Some(p.canonicalize().ok()?)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn can_start(&self) -> bool {
|
pub fn can_start(&self) -> bool {
|
||||||
self.xrservice_binary().is_file()
|
self.xrservice_binary().is_file()
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,6 +87,7 @@ pub struct App {
|
||||||
plugins_worker: Option<JobWorker>,
|
plugins_worker: Option<JobWorker>,
|
||||||
restart_xrservice: bool,
|
restart_xrservice: bool,
|
||||||
build_worker: Option<JobWorker>,
|
build_worker: Option<JobWorker>,
|
||||||
|
monado_gui_worker: Option<JobWorker>,
|
||||||
profiles: Vec<Profile>,
|
profiles: Vec<Profile>,
|
||||||
xr_devices: Vec<XRDevice>,
|
xr_devices: Vec<XRDevice>,
|
||||||
libmonado: Option<libmonado::Monado>,
|
libmonado: Option<libmonado::Monado>,
|
||||||
|
@ -138,6 +139,8 @@ pub enum Msg {
|
||||||
UpdateConfigPlugins(HashMap<String, PluginConfig>),
|
UpdateConfigPlugins(HashMap<String, PluginConfig>),
|
||||||
ShowThemeManager,
|
ShowThemeManager,
|
||||||
SaveThemeConfig,
|
SaveThemeConfig,
|
||||||
|
LaunchMonadoGui,
|
||||||
|
OnMonadoGuiExit,
|
||||||
NoOp,
|
NoOp,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -339,6 +342,9 @@ impl App {
|
||||||
if let Some(w) = self.plugins_worker.as_ref() {
|
if let Some(w) = self.plugins_worker.as_ref() {
|
||||||
w.stop();
|
w.stop();
|
||||||
}
|
}
|
||||||
|
if let Some(w) = self.monado_gui_worker.as_ref() {
|
||||||
|
w.stop();
|
||||||
|
}
|
||||||
if let Some(w) = self.openxr_prober_worker.as_ref() {
|
if let Some(w) = self.openxr_prober_worker.as_ref() {
|
||||||
w.stop();
|
w.stop();
|
||||||
// this can cause threads to remain hanging...
|
// this can cause threads to remain hanging...
|
||||||
|
@ -919,6 +925,29 @@ impl AsyncComponent for App {
|
||||||
self.config.plugins = cp;
|
self.config.plugins = cp;
|
||||||
self.config.save();
|
self.config.save();
|
||||||
}
|
}
|
||||||
|
Msg::LaunchMonadoGui => {
|
||||||
|
if self.monado_gui_worker.is_some() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let profile = self.get_selected_profile();
|
||||||
|
if let Some(bin) = profile.monado_gui_binary() {
|
||||||
|
let mut jobs = VecDeque::new();
|
||||||
|
jobs.push_back(WorkerJob::new_cmd(
|
||||||
|
Some(profile.environment.clone()),
|
||||||
|
bin.to_string_lossy().to_string(),
|
||||||
|
None,
|
||||||
|
));
|
||||||
|
let worker = JobWorker::new(jobs, sender.input_sender(), |msg| match msg {
|
||||||
|
JobWorkerOut::Log(rows) => Msg::OnServiceLog(rows),
|
||||||
|
JobWorkerOut::Exit(_) => Msg::OnMonadoGuiExit,
|
||||||
|
});
|
||||||
|
worker.start();
|
||||||
|
self.monado_gui_worker = Some(worker);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Msg::OnMonadoGuiExit => {
|
||||||
|
self.monado_gui_worker = None;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1087,6 +1116,7 @@ impl AsyncComponent for App {
|
||||||
MainViewOutMsg::SaveProfile(p) => Msg::SaveProfile(p),
|
MainViewOutMsg::SaveProfile(p) => Msg::SaveProfile(p),
|
||||||
MainViewOutMsg::OpenLibsurviveSetup => Msg::OpenLibsurviveSetup,
|
MainViewOutMsg::OpenLibsurviveSetup => Msg::OpenLibsurviveSetup,
|
||||||
MainViewOutMsg::BuildProfile(clean) => Msg::BuildProfile(clean),
|
MainViewOutMsg::BuildProfile(clean) => Msg::BuildProfile(clean),
|
||||||
|
MainViewOutMsg::LaunchMonadoGui => Msg::LaunchMonadoGui,
|
||||||
}),
|
}),
|
||||||
vkinfo,
|
vkinfo,
|
||||||
debug_view: DebugView::builder()
|
debug_view: DebugView::builder()
|
||||||
|
@ -1126,6 +1156,7 @@ impl AsyncComponent for App {
|
||||||
xrservice_worker: None,
|
xrservice_worker: None,
|
||||||
plugins_worker: None,
|
plugins_worker: None,
|
||||||
build_worker: None,
|
build_worker: None,
|
||||||
|
monado_gui_worker: None,
|
||||||
xr_devices: vec![],
|
xr_devices: vec![],
|
||||||
restart_xrservice: false,
|
restart_xrservice: false,
|
||||||
libmonado: None,
|
libmonado: None,
|
||||||
|
|
|
@ -119,6 +119,7 @@ pub enum MainViewOutMsg {
|
||||||
OpenLibsurviveSetup,
|
OpenLibsurviveSetup,
|
||||||
/// params: clean
|
/// params: clean
|
||||||
BuildProfile(bool),
|
BuildProfile(bool),
|
||||||
|
LaunchMonadoGui,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct MainViewInit {
|
pub struct MainViewInit {
|
||||||
|
@ -385,6 +386,19 @@ impl AsyncComponent for MainView {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
gtk::Button {
|
||||||
|
#[track = "model.changed(Self::xrservice_active()) || model.changed(Self::xrservice_ready())"]
|
||||||
|
set_visible: model.xrservice_active
|
||||||
|
&& model.xrservice_ready
|
||||||
|
&& model.selected_profile.xrservice_type == XRServiceType::Monado
|
||||||
|
&& model.selected_profile.monado_gui_binary().is_some(),
|
||||||
|
set_label: "Launch Monado GUI",
|
||||||
|
connect_clicked[sender] => move |_| {
|
||||||
|
sender
|
||||||
|
.output(Self::Output::LaunchMonadoGui)
|
||||||
|
.expect(SENDER_IO_ERR_MSG);
|
||||||
|
},
|
||||||
|
},
|
||||||
gtk::Box {
|
gtk::Box {
|
||||||
set_orientation: gtk::Orientation::Vertical,
|
set_orientation: gtk::Orientation::Vertical,
|
||||||
set_hexpand: true,
|
set_hexpand: true,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue