mirror of
https://gitlab.com/gabmus/envision.git
synced 2025-08-01 13:48:47 +00:00
feat: add a debug option to copy profile env vars (#101)
This commit is contained in:
parent
6cf5e40b96
commit
193505a067
3 changed files with 44 additions and 22 deletions
|
@ -288,17 +288,7 @@ impl Default for Profile {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Profile {
|
impl Profile {
|
||||||
pub fn get_env_vars(&self) -> Vec<String> {
|
pub fn xr_runtime_json_env_var(&self) -> String {
|
||||||
if self.can_be_built {
|
|
||||||
return vec![
|
|
||||||
"PRESSURE_VESSEL_FILESYSTEMS_RW=\"$XDG_RUNTIME_DIR/wivrn_comp_ipc:$XDG_RUNTIME_DIR/monado_comp_ipc\"".into(),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
vec![
|
|
||||||
// format!(
|
|
||||||
// "VR_OVERRIDE={opencomp}/build",
|
|
||||||
// opencomp = self.opencomposite_path,
|
|
||||||
// ),
|
|
||||||
format!(
|
format!(
|
||||||
"XR_RUNTIME_JSON=\"{prefix}/share/openxr/1/openxr_{runtime}.json\"",
|
"XR_RUNTIME_JSON=\"{prefix}/share/openxr/1/openxr_{runtime}.json\"",
|
||||||
prefix = match self.prefix.as_str() {
|
prefix = match self.prefix.as_str() {
|
||||||
|
@ -309,7 +299,17 @@ impl Profile {
|
||||||
XRServiceType::Monado => "monado",
|
XRServiceType::Monado => "monado",
|
||||||
XRServiceType::Wivrn => "wivrn",
|
XRServiceType::Wivrn => "wivrn",
|
||||||
}
|
}
|
||||||
),
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// always adds the xr runtime json var
|
||||||
|
pub fn env_vars_full(&self) -> Vec<String> {
|
||||||
|
vec![
|
||||||
|
// format!(
|
||||||
|
// "VR_OVERRIDE={opencomp}/build",
|
||||||
|
// opencomp = self.opencomposite_path,
|
||||||
|
// ),
|
||||||
|
self.xr_runtime_json_env_var(),
|
||||||
format!(
|
format!(
|
||||||
"PRESSURE_VESSEL_FILESYSTEMS_RW=\"{path}\"",
|
"PRESSURE_VESSEL_FILESYSTEMS_RW=\"{path}\"",
|
||||||
path = get_ipc_file_path(&self.xrservice_type),
|
path = get_ipc_file_path(&self.xrservice_type),
|
||||||
|
@ -317,6 +317,15 @@ impl Profile {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn get_env_vars(&self) -> Vec<String> {
|
||||||
|
if self.can_be_built {
|
||||||
|
return vec![
|
||||||
|
"PRESSURE_VESSEL_FILESYSTEMS_RW=\"$XDG_RUNTIME_DIR/wivrn_comp_ipc:$XDG_RUNTIME_DIR/monado_comp_ipc\"".into(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
self.env_vars_full()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn get_steam_launch_options(&self) -> String {
|
pub fn get_steam_launch_options(&self) -> String {
|
||||||
let mut vars = self.get_env_vars();
|
let mut vars = self.get_env_vars();
|
||||||
vars.push("%command%".into());
|
vars.push("%command%".into());
|
||||||
|
|
|
@ -130,6 +130,7 @@ pub enum Msg {
|
||||||
Quit,
|
Quit,
|
||||||
DebugOpenPrefix,
|
DebugOpenPrefix,
|
||||||
DebugOpenData,
|
DebugOpenData,
|
||||||
|
DebugCopyEnvVars,
|
||||||
OpenWivrnConfig,
|
OpenWivrnConfig,
|
||||||
HandleCommandLine(CmdLineOpts),
|
HandleCommandLine(CmdLineOpts),
|
||||||
}
|
}
|
||||||
|
@ -684,6 +685,9 @@ impl SimpleComponent for App {
|
||||||
self.get_selected_profile().prefix
|
self.get_selected_profile().prefix
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
Msg::DebugCopyEnvVars => {
|
||||||
|
copy_text(&self.get_selected_profile().env_vars_full().join(" "));
|
||||||
|
}
|
||||||
Msg::OpenWivrnConfig => {
|
Msg::OpenWivrnConfig => {
|
||||||
let editor = WivrnConfEditor::builder()
|
let editor = WivrnConfEditor::builder()
|
||||||
.launch(WivrnConfEditorInit {
|
.launch(WivrnConfEditorInit {
|
||||||
|
@ -845,6 +849,13 @@ impl SimpleComponent for App {
|
||||||
sender.input(Msg::DebugOpenPrefix);
|
sender.input(Msg::DebugOpenPrefix);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
stateless_action!(
|
||||||
|
actions,
|
||||||
|
DebugCopyEnvVarsAction,
|
||||||
|
clone!(@strong sender => move |_| {
|
||||||
|
sender.input(Msg::DebugCopyEnvVars);
|
||||||
|
})
|
||||||
|
);
|
||||||
actions.add_action(RelmAction::<DebugViewToggleAction>::new_stateful(
|
actions.add_action(RelmAction::<DebugViewToggleAction>::new_stateful(
|
||||||
&model.enable_debug_view,
|
&model.enable_debug_view,
|
||||||
clone!(@strong sender => move |_, state| {
|
clone!(@strong sender => move |_, state| {
|
||||||
|
@ -891,3 +902,4 @@ new_stateful_action!(pub DebugViewToggleAction, AppActionGroup, "debugviewtoggle
|
||||||
|
|
||||||
new_stateless_action!(pub DebugOpenDataAction, AppActionGroup, "debugopendata");
|
new_stateless_action!(pub DebugOpenDataAction, AppActionGroup, "debugopendata");
|
||||||
new_stateless_action!(pub DebugOpenPrefixAction, AppActionGroup, "debugopenprefix");
|
new_stateless_action!(pub DebugOpenPrefixAction, AppActionGroup, "debugopenprefix");
|
||||||
|
new_stateless_action!(pub DebugCopyEnvVarsAction, AppActionGroup, "debugcopyenvvars");
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use super::term_widget::TermWidget;
|
use super::term_widget::TermWidget;
|
||||||
use crate::log_level::LogLevel;
|
use crate::log_level::LogLevel;
|
||||||
use crate::log_parser::MonadoLog;
|
use crate::log_parser::MonadoLog;
|
||||||
use crate::ui::app::{DebugOpenDataAction, DebugOpenPrefixAction};
|
use crate::ui::app::{DebugCopyEnvVarsAction, DebugOpenDataAction, DebugOpenPrefixAction};
|
||||||
use crate::ui::util::copy_text;
|
use crate::ui::util::copy_text;
|
||||||
use gtk::glib::clone;
|
use gtk::glib::clone;
|
||||||
use gtk::prelude::*;
|
use gtk::prelude::*;
|
||||||
|
@ -59,6 +59,7 @@ impl SimpleComponent for DebugView {
|
||||||
section! {
|
section! {
|
||||||
"Open _Data Folder" => DebugOpenDataAction,
|
"Open _Data Folder" => DebugOpenDataAction,
|
||||||
"Open _Prefix Folder" => DebugOpenPrefixAction,
|
"Open _Prefix Folder" => DebugOpenPrefixAction,
|
||||||
|
"Copy Profile _Environment Variables" => DebugCopyEnvVarsAction,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue