From d34ae3a8a6d678bc7f565116567d01bf0df260f8 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 20 Mar 2026 20:35:01 +0000 Subject: [PATCH 1/2] fix(scratchpad): properly map and unmap scratchpad windows The scratchpad logic incorrectly attempted to hide windows by merely modifying their tags and invoking `arrange()`. On the Wayland backend, this led to the window state terminating early or leaving the window on screen without mapping/unmapping correctly since it bypassed the necessary logic inside `crate::client::hide()` and `crate::client::show()`. This patch updates `scratchpad_make`, `scratchpad_hide_name`, `scratchpad_show_name`, and `scratchpad_unmake` to explicitly use `crate::client::hide` and `crate::client::show` to effectively update visibility on both X11 and Wayland backends. Co-authored-by: paperbenni <15818888+paperbenni@users.noreply.github.com> --- src/floating/scratchpad.rs | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/src/floating/scratchpad.rs b/src/floating/scratchpad.rs index b55046cb..9c03677e 100644 --- a/src/floating/scratchpad.rs +++ b/src/floating/scratchpad.rs @@ -1,6 +1,6 @@ use crate::contexts::WmCtx; use crate::globals::Globals; -use crate::layouts::{arrange, restack}; +use crate::layouts::arrange; use crate::types::{SCRATCHPAD_MASK, WindowId}; use bincode::{Decode, Encode}; @@ -75,11 +75,7 @@ pub fn scratchpad_make(ctx: &mut WmCtx, name: &str, window_id: Option) client.is_floating = true; } - let selected_monitor_id = ctx.core_mut().globals_mut().selected_monitor_id(); - crate::focus::focus_soft(ctx, None); - if !ctx.core_mut().globals_mut().monitors.is_empty() { - arrange(ctx, Some(selected_monitor_id)); - } + crate::client::hide(ctx, selected_window); } pub fn scratchpad_unmake(ctx: &mut WmCtx, window_id: Option) { @@ -103,7 +99,9 @@ pub fn scratchpad_unmake(ctx: &mut WmCtx, window_id: Option) { let restore_tags = client.scratchpad_restore_tags; let monitor_id = client.monitor_id; + let mut was_hidden = false; if let Some(client) = ctx.client_mut(selected_window) { + was_hidden = client.is_hidden; client.scratchpad_name.clear(); client.issticky = false; client.tags = if restore_tags != 0 { @@ -114,7 +112,11 @@ pub fn scratchpad_unmake(ctx: &mut WmCtx, window_id: Option) { client.scratchpad_restore_tags = 0; } - arrange(ctx, Some(monitor_id)); + if was_hidden { + crate::client::show(ctx, selected_window); + } else { + arrange(ctx, Some(monitor_id)); + } } pub fn scratchpad_show_name(ctx: &mut WmCtx, name: &str) -> Result { @@ -160,14 +162,18 @@ pub fn scratchpad_show_name(ctx: &mut WmCtx, name: &str) -> Result) { From a83fb458fd0fe5baa38ce04a6c0b4339effc2d58 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 20 Mar 2026 20:42:05 +0000 Subject: [PATCH 2/2] fix(scratchpad): properly map and unmap scratchpad windows The scratchpad logic incorrectly attempted to hide windows by merely modifying their tags and invoking `arrange()`. On the Wayland backend, this led to the window state terminating early or leaving the window on screen without mapping/unmapping correctly since it bypassed the necessary logic inside `crate::client::hide()` and `crate::client::show()`. This patch updates `scratchpad_make`, `scratchpad_hide_name`, `scratchpad_show_name`, and `scratchpad_unmake` to explicitly use `crate::client::hide` and `crate::client::show` to effectively update visibility on both X11 and Wayland backends. Co-authored-by: paperbenni <15818888+paperbenni@users.noreply.github.com> --- src/floating/scratchpad.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/floating/scratchpad.rs b/src/floating/scratchpad.rs index 9c03677e..687430dc 100644 --- a/src/floating/scratchpad.rs +++ b/src/floating/scratchpad.rs @@ -170,6 +170,7 @@ pub fn scratchpad_show_name(ctx: &mut WmCtx, name: &str) -> Result