diff --git a/src/shojiwm_lib/src/handlers/compositor.rs b/src/shojiwm_lib/src/handlers/compositor.rs index 5fcd8b8e..313a6879 100644 --- a/src/shojiwm_lib/src/handlers/compositor.rs +++ b/src/shojiwm_lib/src/handlers/compositor.rs @@ -690,6 +690,18 @@ impl CompositorHandler for ShojiWM { window.on_commit(); // Before the snapshot below, which derives the window position from the location. self.keep_client_origin_across_geometry_change(&window); + // A toplevel is announced on the foreign-toplevel protocols once it has a buffer, + // not when its role is made: one that never shows anything (started hidden) is no + // window for a taskbar. Idempotent, so every commit of a shown window can ask. + if let Some(toplevel) = window.toplevel() + && smithay::backend::renderer::utils::with_renderer_surface_state( + toplevel.wl_surface(), + |state| state.buffer().is_some(), + ) + .unwrap_or(false) + { + self.install_foreign_toplevel(&window); + } // Title / app_id may have changed via xdg_toplevel set_title / // set_app_id between commits. sync_foreign_toplevel short-circuits // when nothing changed so this is cheap. diff --git a/src/shojiwm_lib/src/handlers/xdg_shell.rs b/src/shojiwm_lib/src/handlers/xdg_shell.rs index 77e9b6b7..506ac323 100644 --- a/src/shojiwm_lib/src/handlers/xdg_shell.rs +++ b/src/shojiwm_lib/src/handlers/xdg_shell.rs @@ -146,10 +146,9 @@ impl XdgShellHandler for ShojiWM { self.space .map_element(window.clone(), initial_location, false); self.ensure_wayland_window_decoration_policy(&wl_surface); - // Announce the new toplevel on ext-foreign-toplevel-list-v1 so shells - // and the portal picker can see it. Has to happen after map so the - // initial title/app_id reads from xdg state succeed. - self.install_foreign_toplevel(&window); + // The foreign-toplevel handles come with the first buffer (the commit handler): a + // toplevel that never shows anything, such as a program started hidden in the + // notification area, is no window for a taskbar. if uses_xwayland_refresh_override { self.update_xwayland_refresh_override_for_window(&window, "xdg-toplevel-map"); }