App launcher
[skip ci]
This commit is contained in:
@@ -3,6 +3,7 @@ use gtk::traits::IconThemeExt;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
// compatibility with wayvr-ipc
|
||||
// TODO: remove this after we're done with the old wayvr-dashboard and use DesktopEntry instead
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
pub struct DesktopFile {
|
||||
pub name: String,
|
||||
@@ -13,7 +14,6 @@ pub struct DesktopFile {
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[allow(dead_code)] // TODO: remove this
|
||||
pub struct DesktopEntry {
|
||||
pub exec_path: String,
|
||||
pub exec_args: Vec<String>,
|
||||
@@ -140,3 +140,15 @@ pub fn find_entries() -> anyhow::Result<Vec<DesktopEntry>> {
|
||||
|
||||
Ok(res)
|
||||
}
|
||||
|
||||
impl DesktopEntry {
|
||||
pub fn to_desktop_file(&self) -> DesktopFile {
|
||||
DesktopFile {
|
||||
categories: self.categories.clone(),
|
||||
exec_args: self.exec_args.clone(),
|
||||
exec_path: self.exec_path.clone(),
|
||||
icon: self.icon_path.clone(),
|
||||
name: self.app_name.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,10 @@ use wgui::{
|
||||
widget::label::WidgetLabel,
|
||||
};
|
||||
|
||||
use crate::frontend::{FrontendTask, FrontendTasks};
|
||||
use crate::{
|
||||
frontend::{FrontendTask, FrontendTasks},
|
||||
settings::SettingsIO,
|
||||
};
|
||||
|
||||
pub struct PopupManagerParams {
|
||||
pub parent_id: WidgetID,
|
||||
@@ -55,6 +58,7 @@ pub struct PopupManager {
|
||||
|
||||
pub struct PopupContentFuncData<'a> {
|
||||
pub layout: &'a mut Layout,
|
||||
pub settings: &'a dyn SettingsIO,
|
||||
pub handle: PopupHandle,
|
||||
pub id_content: WidgetID,
|
||||
}
|
||||
@@ -119,6 +123,7 @@ impl PopupManager {
|
||||
pub fn mount_popup(
|
||||
&mut self,
|
||||
globals: WguiGlobals,
|
||||
settings: &dyn SettingsIO,
|
||||
layout: &mut Layout,
|
||||
frontend_tasks: FrontendTasks,
|
||||
params: MountPopupParams,
|
||||
@@ -175,6 +180,7 @@ impl PopupManager {
|
||||
layout,
|
||||
handle: popup_handle.clone(),
|
||||
id_content,
|
||||
settings,
|
||||
})?;
|
||||
|
||||
Ok(())
|
||||
|
||||
@@ -130,7 +130,7 @@ impl ToastManager {
|
||||
// show-up animation
|
||||
layout.animations.add(Animation::new(
|
||||
rect.id,
|
||||
160, // does not use anim_mult
|
||||
(120.0 * globals.defaults.animation_mult) as u32,
|
||||
AnimationEasing::Linear,
|
||||
Box::new(move |common, data| {
|
||||
let pos_showup = AnimationEasing::OutQuint.interpolate((data.pos * 4.0).min(1.0));
|
||||
@@ -138,7 +138,7 @@ impl ToastManager {
|
||||
let scale = AnimationEasing::OutBack.interpolate((data.pos * 4.0).min(1.0));
|
||||
|
||||
{
|
||||
let mtx = Mat4::from_translation(Vec3::new(0.0, (1.0 - pos_showup) * 100.0, 0.0))
|
||||
let mtx = Mat4::from_translation(Vec3::new(0.0, (1.0 - pos_showup) * 20.0, 0.0))
|
||||
* Mat4::from_scale(Vec3::new(scale, scale, 1.0));
|
||||
data.data.transform = centered_matrix(data.widget_boundary.size, &mtx);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user