diff --git a/src/modules/launcher/mod.rs b/src/modules/launcher/mod.rs index 5968bda..9cd2490 100644 --- a/src/modules/launcher/mod.rs +++ b/src/modules/launcher/mod.rs @@ -427,6 +427,7 @@ impl Module for LauncherModule { .name("popup-launcher") .build(); + // we need some content to force the container to have a size let placeholder = Button::with_label("PLACEHOLDER"); placeholder.set_width_request(MAX_WIDTH); container.add(&placeholder); @@ -439,6 +440,7 @@ impl Module for LauncherModule { match event { LauncherUpdate::AddItem(item) => { let app_id = item.app_id.clone(); + trace!("Adding item with id '{app_id}' to the popup: {item:?}"); let window_buttons = item .windows @@ -468,6 +470,11 @@ impl Module for LauncherModule { buttons.insert(app_id, window_buttons); } LauncherUpdate::AddWindow(app_id, win) => { + debug!( + "Adding new window to popup for '{app_id}': '{}' ({})", + win.name, win.id + ); + if let Some(buttons) = buttons.get_mut(&app_id) { let button = Button::builder() .height_request(40) @@ -490,11 +497,17 @@ impl Module for LauncherModule { } } LauncherUpdate::RemoveWindow(app_id, win_id) => { + debug!("Removing window from popup for '{app_id}': {win_id}"); + if let Some(buttons) = buttons.get_mut(&app_id) { buttons.remove(&win_id); } } LauncherUpdate::Title(app_id, win_id, title) => { + debug!( + "Updating window title on popup for '{app_id}'/{win_id} to '{title}'" + ); + if let Some(buttons) = buttons.get_mut(&app_id) { if let Some(button) = buttons.get(&win_id) { button.set_label(&title); diff --git a/src/wayland/client.rs b/src/wayland/client.rs index afeed12..27bdb2c 100644 --- a/src/wayland/client.rs +++ b/src/wayland/client.rs @@ -2,6 +2,8 @@ use super::{Env, ToplevelHandler}; use crate::wayland::toplevel::{ToplevelEvent, ToplevelInfo}; use crate::wayland::toplevel_manager::listen_for_toplevels; use crate::wayland::ToplevelChange; +use color_eyre::Report; +use indexmap::IndexMap; use smithay_client_toolkit::environment::Environment; use smithay_client_toolkit::output::{with_output_info, OutputInfo}; use smithay_client_toolkit::reexports::calloop; @@ -10,7 +12,7 @@ use std::sync::{Arc, RwLock}; use std::time::Duration; use tokio::sync::{broadcast, oneshot}; use tokio::task::spawn_blocking; -use tracing::trace; +use tracing::{error, trace}; use wayland_client::protocol::wl_seat::WlSeat; use wayland_protocols::wlr::unstable::foreign_toplevel::v1::client::{ zwlr_foreign_toplevel_handle_v1::ZwlrForeignToplevelHandleV1, @@ -88,9 +90,12 @@ impl WaylandClient { loop { // TODO: Avoid need for duration here - can we force some event when sending requests? - event_loop - .dispatch(Duration::from_millis(50), &mut ()) - .expect("Failed to dispatch pending wayland events"); + if let Err(err) = event_loop.dispatch(Duration::from_millis(50), &mut ()) { + error!( + "{:?}", + Report::new(err).wrap_err("Failed to dispatch pending wayland events") + ); + } } });