feat: allow XWayland window to start minimized

This commit is contained in:
RipleyTom 2026-07-27 20:53:57 +02:00 • committed by Victoria Brekenfeld
parent 5c93094574
commit 94178034dd
3 changed files with 15 additions and 2 deletions

View file

@ -254,6 +254,7 @@ pub struct PendingWindow {
pub surface: CosmicSurface,
pub seat: Seat<State>,
pub fullscreen: Option<Output>,
pub minimized: bool,
pub maximized: bool,
pub sticky: bool,
}
@ -2856,6 +2857,7 @@ impl Shell {
surface: window,
seat,
fullscreen: output,
minimized: should_be_minimized,
maximized: should_be_maximized,
sticky: mut should_be_sticky,
} = self.pending_windows.remove(pos);
@ -2939,6 +2941,7 @@ impl Shell {
if let Some(FocusTarget::Window(focused)) = maybe_focused
&& let Some(stack) = focused.stack_ref()
&& !is_dialog
&& !should_be_minimized
&& !should_be_maximized
&& !(workspace.is_tiled(&focused.active_window()) && floating_exception)
{
@ -2988,8 +2991,13 @@ impl Shell {
self.maximize_request(&mapped, &seat, false, loop_handle);
}
let new_target = if (workspace_output == seat.active_output()
&& active_handle == workspace_handle)
if should_be_minimized {
self.minimize_request(&window);
}
let new_target = if should_be_minimized {
None
} else if (workspace_output == seat.active_output() && active_handle == workspace_handle)
|| should_be_sticky
{
// TODO: enforce focus stealing prevention by also checking the same rules as for the else case.
@ -3113,6 +3121,7 @@ impl Shell {
surface,
seat: seat.clone(),
fullscreen: None,
minimized: false,
maximized: false,
sticky: false,
});

View file

@ -50,6 +50,7 @@ impl XdgShellHandler for State {
surface,
seat,
fullscreen: None,
minimized: false,
maximized: false,
sticky: false,
})

View file

@ -808,6 +808,7 @@ impl XwmHandler for State {
);
}
let fullscreen = window.is_fullscreen().then(|| seat.active_output());
let minimized = window.is_hidden();
let maximized = window.is_maximized();
if let Some(pending) = shell
.pending_windows
@ -816,6 +817,7 @@ impl XwmHandler for State {
{
pending.seat = seat;
pending.fullscreen = fullscreen;
pending.minimized = minimized;
pending.maximized = maximized;
} else {
let surface = CosmicSurface::from(window);
@ -823,6 +825,7 @@ impl XwmHandler for State {
surface,
seat,
fullscreen,
minimized,
maximized,
sticky: false,
})