diff --git a/examples/app_grid.rs b/examples/app_grid.rs index 94f67b6..145be49 100644 --- a/examples/app_grid.rs +++ b/examples/app_grid.rs @@ -214,8 +214,7 @@ impl RootHandler for App { .set_transform(Some(&root), Transform::identity()) .unwrap(); return}; let distance = Vec3::from(distance).length_squared(); - dbg!(distance.sqrt()); - dbg!(ACTIVATION_DISTANCE); + if distance > ACTIVATION_DISTANCE.powi(2) { let _ = application.launch(&space); } diff --git a/examples/hexagon_launcher.rs b/examples/hexagon_launcher.rs index 843969a..f7ef12c 100644 --- a/examples/hexagon_launcher.rs +++ b/examples/hexagon_launcher.rs @@ -1,5 +1,5 @@ use color_eyre::eyre::Result; -use glam::Quat; +use glam::{Quat, Vec3}; use manifest_dir_macros::directory_relative_path; use mint::Vector3; use protostar::{ @@ -437,10 +437,9 @@ impl RootHandler for App { //TODO: split the executable string for the args tokio::task::spawn(async move { let distance_vector = distance_future.await.ok().unwrap().0; - let distance = ((distance_vector.x.powi(2) + distance_vector.y.powi(2)).sqrt() - + distance_vector.z.powi(2)) - .sqrt(); - if dbg!(distance) > ACTIVATION_DISTANCE { + let distance = Vec3::from(distance_vector).length_squared(); + + if distance > ACTIVATION_DISTANCE { let _ = application.launch(&space); } }); diff --git a/examples/sirius.rs b/examples/sirius.rs index 9db1b81..d8efeab 100644 --- a/examples/sirius.rs +++ b/examples/sirius.rs @@ -1,6 +1,6 @@ use clap::{self, Parser}; use color_eyre::eyre::Result; -use glam::Quat; +use glam::{Quat, Vec3}; use manifest_dir_macros::directory_relative_path; use mint::Vector3; use protostar::{ @@ -416,10 +416,9 @@ impl RootHandler for App { //TODO: split the executable string for the args tokio::task::spawn(async move { let distance_vector = distance_future.await.ok().unwrap().0; - let distance = ((distance_vector.x.powi(2) + distance_vector.y.powi(2)).sqrt() - + distance_vector.z.powi(2)) - .sqrt(); - if dbg!(distance) > ACTIVATION_DISTANCE { + let distance = Vec3::from(distance_vector).length_squared(); + + if distance > ACTIVATION_DISTANCE { let _ = application.launch(&space); } }); diff --git a/src/application.rs b/src/application.rs index 9eeae0b..4430f2e 100644 --- a/src/application.rs +++ b/src/application.rs @@ -74,8 +74,11 @@ impl Application { } std::env::set_var("STARDUST_STARTUP_TOKEN", startup_token); + + // Strip/ignore field codes https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s07.html let re = Regex::new(r"%[fFuUdDnNickvm]").unwrap(); let exec = re.replace_all(&executable, ""); + unsafe { Command::new("sh") .arg("-c") diff --git a/src/protostar.rs b/src/protostar.rs index 90b9348..f943445 100644 --- a/src/protostar.rs +++ b/src/protostar.rs @@ -3,7 +3,7 @@ use crate::{ xdg::{DesktopFile, Icon, IconType}, }; use color_eyre::eyre::Result; -use glam::Quat; +use glam::{Quat, Vec3}; use mint::Vector3; use stardust_xr_fusion::{ client::{FrameInfo, RootHandler}, @@ -138,19 +138,6 @@ impl ProtoStar { pub fn content_parent(&self) -> &Spatial { self.grabbable.content_parent() } - pub fn toggle(&mut self) { - self.grabbable.set_enabled(!self.currently_shown).unwrap(); - if self.currently_shown { - self.grabbable_move = Some(Tweener::quart_in_out(1.0, 0.0001, 0.25)); //TODO make the scale a parameter - } else { - self.icon.set_enabled(true).unwrap(); - if let Some(label) = self.label.as_ref() { - label.set_enabled(true).unwrap() - } - self.grabbable_move = Some(Tweener::quart_in_out(0.0001, 1.0, 0.25)); - } - self.currently_shown = !self.currently_shown; - } } impl RootHandler for ProtoStar { fn frame(&mut self, info: FrameInfo) { @@ -240,10 +227,9 @@ impl RootHandler for ProtoStar { //TODO: split the executable string for the args tokio::task::spawn(async move { let distance_vector = distance_future.await.ok().unwrap().0; - let distance = ((distance_vector.x.powi(2) + distance_vector.y.powi(2)).sqrt() - + distance_vector.z.powi(2)) - .sqrt(); - if dbg!(distance) > ACTIVATION_DISTANCE { + let distance = Vec3::from(distance_vector).length_squared(); + + if distance > ACTIVATION_DISTANCE { let _ = application.launch(&space); } });