bar app icons & tooltips

This commit is contained in:
galister
2026-01-05 15:45:19 +09:00
parent b86525d65d
commit b56aa1a8de
30 changed files with 291 additions and 129 deletions

View File

@@ -3,7 +3,6 @@ use dash_frontend::{
settings::{self, SettingsIO},
};
use glam::{Affine2, Affine3A, Vec2, vec2, vec3};
use tracing::instrument::WithSubscriber;
use wayvr_ipc::{
packet_client::WvrProcessLaunchParams,
packet_server::{WvrProcess, WvrProcessHandle, WvrWindow, WvrWindowHandle},
@@ -376,11 +375,13 @@ impl DashInterface<AppState> for DashInterfaceLive {
wvr_server
.spawn_process(
&params.name,
&params.exec,
&args_vec,
&env_vec,
params.resolution,
None,
params.icon.as_deref(),
params.userdata,
)
.map(|x| x.as_packet())
@@ -434,4 +435,11 @@ impl DashInterface<AppState> for DashInterfaceLive {
.enqueue(TaskType::Playspace(PlayspaceTask::Recenter));
Ok(())
}
fn desktop_finder<'a>(
&'a mut self,
data: &'a mut AppState,
) -> &'a mut wlx_common::desktop_finder::DesktopFinder {
&mut data.desktop_finder
}
}

View File

@@ -9,7 +9,7 @@ use crate::{
use anyhow::Context;
use glam::{FloatExt, Mat4, Vec2, vec2, vec3};
use wgui::{
animation::{Animation, AnimationEasing}, assets::AssetPath, components::button::ComponentButton, drawing::{self, Color}, event::{self, CallbackDataCommon, CallbackMetadata, EventAlterables, EventListenerKind}, layout::LayoutUpdateParams, parser::{Fetchable, ParseDocumentExtra, ParseDocumentParams}, renderer_vk::util, taffy::{self, prelude::length}, widget::{div::WidgetDiv, rectangle::WidgetRectangle, EventResult}
animation::{Animation, AnimationEasing}, assets::AssetPath, components::button::ComponentButton, drawing::{self, Color}, event::{self, CallbackDataCommon, CallbackMetadata, EventAlterables, EventListenerKind}, layout::LayoutUpdateParams, parser::{Fetchable, ParseDocumentParams}, renderer_vk::util, taffy::{self, prelude::length}, widget::{div::WidgetDiv, rectangle::WidgetRectangle, EventResult}
};
use super::{
@@ -319,6 +319,7 @@ pub(super) fn create_keyboard_panel(
("Panel", panels_root)
},
OverlayCategory::WayVR => {
params.insert("icon".into(), meta.icon.as_ref().expect("WayVR overlay without Icon attribute!").as_ref().into());
("App", apps_root)
},
_ => continue

View File

@@ -51,9 +51,11 @@ pub fn create_wl_window_overlay(
name: Arc<str>,
app: &mut AppState,
window: wayvr::window::WindowHandle,
size_major: u32,
icon: Arc<str>,
size: [u32; 2],
) -> anyhow::Result<OverlayWindowConfig> {
let scale = size_major as f32 / 1920.0;
let scale = size[0].max(size[1]) as f32 / 1920.0;
let curve_scale = size[0] as f32 / 1920.0;
Ok(OverlayWindowConfig {
name: name.clone(),
@@ -61,7 +63,7 @@ pub fn create_wl_window_overlay(
grabbable: true,
interactable: true,
positioning: Positioning::Floating,
curvature: Some(0.15),
curvature: Some(0.15 * curve_scale),
transform: Affine3A::from_scale_rotation_translation(
Vec3::ONE * scale,
Quat::IDENTITY,
@@ -72,12 +74,15 @@ pub fn create_wl_window_overlay(
keyboard_focus: Some(KeyboardFocus::WayVR),
category: OverlayCategory::WayVR,
show_on_spawn: true,
..OverlayWindowConfig::from_backend(Box::new(WvrWindowBackend::new(name, app, window)?))
..OverlayWindowConfig::from_backend(Box::new(WvrWindowBackend::new(
name, app, window, icon,
)?))
})
}
pub struct WvrWindowBackend {
name: Arc<str>,
icon: Arc<str>,
pipeline: Option<ScreenPipeline>,
popups_pipeline: Arc<WGfxPipeline<Vert2Uv>>,
interaction_transform: Option<Affine2>,
@@ -100,6 +105,7 @@ impl WvrWindowBackend {
name: Arc<str>,
app: &mut AppState,
window: wayvr::window::WindowHandle,
icon: Arc<str>,
) -> anyhow::Result<Self> {
let popups_pipeline = app.gfx.create_pipeline(
app.gfx_extras.shaders.get("vert_quad").unwrap(), // want panic
@@ -170,6 +176,7 @@ impl WvrWindowBackend {
Ok(Self {
name,
icon,
pipeline: None,
window,
popups: vec![],
@@ -508,6 +515,7 @@ impl OverlayBackend for WvrWindowBackend {
fn get_attrib(&self, attrib: BackendAttrib) -> Option<BackendAttribValue> {
match attrib {
BackendAttrib::Stereo => self.stereo.map(BackendAttribValue::Stereo),
BackendAttrib::Icon => Some(BackendAttribValue::Icon(self.icon.clone())),
_ => None,
}
}