glob-based icon discovery but very slow
This commit is contained in:
@@ -85,12 +85,12 @@ impl View {
|
||||
|
||||
label_exec.set_text_simple(
|
||||
&mut params.globals.get(),
|
||||
Translation::from_raw_text_string(params.entry.app_name.clone()),
|
||||
Translation::from_raw_text_rc(params.entry.app_name.clone()),
|
||||
);
|
||||
|
||||
label_args.set_text_simple(
|
||||
&mut params.globals.get(),
|
||||
Translation::from_raw_text_string(params.entry.exec_args.join(" ")),
|
||||
Translation::from_raw_text_rc(params.entry.exec_args.clone()),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ impl View {
|
||||
// app icon
|
||||
if let Some(icon_path) = ¶ms.entry.icon_path {
|
||||
let mut template_params: HashMap<Rc<str>, Rc<str>> = HashMap::new();
|
||||
template_params.insert("path".into(), icon_path.as_str().into());
|
||||
template_params.insert("path".into(), icon_path.clone());
|
||||
state.instantiate_template(
|
||||
doc_params,
|
||||
"ApplicationIcon",
|
||||
@@ -225,27 +225,23 @@ impl View {
|
||||
env.push("ELECTRON_OZONE_PLATFORM_HINT=wayland".into());
|
||||
}
|
||||
|
||||
// TODO: refactor this after we ditch old wayvr-dashboard completely
|
||||
let desktop_file = params.application.to_desktop_file();
|
||||
let mut userdata = HashMap::<String, String>::new();
|
||||
userdata.insert("desktop_file".into(), serde_json::to_string(&desktop_file)?);
|
||||
|
||||
let exec_args_str = desktop_file.exec_args.join(" ");
|
||||
|
||||
let args = match params.run_mode {
|
||||
RunMode::Cage => format!("-- {} {}", desktop_file.exec_path, exec_args_str),
|
||||
RunMode::Wayland => exec_args_str,
|
||||
RunMode::Cage => format!("-- {} {}", params.application.exec_path, params.application.exec_args),
|
||||
RunMode::Wayland => params.application.exec_args.to_string(),
|
||||
};
|
||||
|
||||
let exec = match params.run_mode {
|
||||
RunMode::Cage => "cage",
|
||||
RunMode::Wayland => &desktop_file.name,
|
||||
RunMode::Cage => "cage".to_string(),
|
||||
RunMode::Wayland => params.application.exec_path.to_string(),
|
||||
};
|
||||
|
||||
let mut userdata = HashMap::new();
|
||||
userdata.insert("desktop-entry".to_string(), serde_json::to_string(params.application)?);
|
||||
|
||||
params.interface.process_launch(WvrProcessLaunchParams {
|
||||
env,
|
||||
exec: String::from(exec),
|
||||
name: desktop_file.name,
|
||||
exec,
|
||||
name: params.application.app_name.to_string(),
|
||||
args,
|
||||
userdata,
|
||||
})?;
|
||||
|
||||
@@ -15,9 +15,9 @@ use wgui::{
|
||||
taffy::{self, prelude::length},
|
||||
task::Tasks,
|
||||
widget::{
|
||||
ConstructEssentials,
|
||||
div::WidgetDiv,
|
||||
label::{WidgetLabel, WidgetLabelParams},
|
||||
ConstructEssentials,
|
||||
},
|
||||
};
|
||||
use wlx_common::dash_interface::BoxDashInterface;
|
||||
@@ -89,13 +89,13 @@ impl View {
|
||||
}
|
||||
}
|
||||
|
||||
fn get_desktop_file_from_process(process: &packet_server::WvrProcess) -> Option<desktop_finder::DesktopFile> {
|
||||
fn get_desktop_entry_from_process(process: &packet_server::WvrProcess) -> Option<desktop_finder::DesktopEntry> {
|
||||
// TODO: refactor this after we ditch old wayvr-dashboard completely
|
||||
let Some(dfile_str) = process.userdata.get("desktop_file") else {
|
||||
let Some(dfile_str) = process.userdata.get("desktop-entry") else {
|
||||
return None;
|
||||
};
|
||||
|
||||
let Ok(desktop_file) = serde_json::from_str::<desktop_finder::DesktopFile>(dfile_str) else {
|
||||
let Ok(desktop_file) = serde_json::from_str::<desktop_finder::DesktopEntry>(dfile_str) else {
|
||||
debug_assert!(false); // invalid json???
|
||||
return None;
|
||||
};
|
||||
@@ -144,7 +144,7 @@ fn construct_process_entry(
|
||||
},
|
||||
)?;
|
||||
|
||||
if let Some(desktop_file) = get_desktop_file_from_process(process) {
|
||||
if let Some(desktop_file) = get_desktop_entry_from_process(process) {
|
||||
// desktop file icon and process name
|
||||
util::various::mount_simple_sprite_square(
|
||||
globals,
|
||||
@@ -158,7 +158,7 @@ fn construct_process_entry(
|
||||
globals,
|
||||
ess.layout,
|
||||
cell.id,
|
||||
Translation::from_raw_text_string(desktop_file.name.clone()),
|
||||
Translation::from_raw_text_rc(desktop_file.app_name.clone()),
|
||||
)?;
|
||||
} else {
|
||||
// just show a process name
|
||||
|
||||
Reference in New Issue
Block a user