diff --git a/CHANGELOG.md b/CHANGELOG.md index f7ac511..cac67f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -70,3 +70,14 @@ `layout-apply` against the desktop when only a terminal (or any unrelated window) is open. - **Profile:** `Character` derives `Default` (needed for the padding). + +- **Overlay:** `set_margin` arguments corrected to `(top, right, bottom, + left)`. The previous `(rect.y, rect.x, 0, 0)` passed `rect.x` as the + *right* margin, which is a no-op under TOP+LEFT anchoring — so the + overlay's x offset was silently dropped. Now `(y, 0, 0, x)` which + pushes the surface down by `y` and right by `x`. +- **Overlay:** Left-click on a slot no longer sets `state.exited = true`. + Doing so dropped the badge and left `OverlayHub.by_slot` still + holding the slot, so the hub refused to respawn it. The compositor's + `zwlr_layer_surface::Closed` event is the only path that tears the + live thread down — click just sends the swap IPC and returns. diff --git a/src/wayland_layer.rs b/src/wayland_layer.rs index 95c9d2e..e5d71fe 100644 --- a/src/wayland_layer.rs +++ b/src/wayland_layer.rs @@ -229,9 +229,12 @@ fn run(slot: u32, rect: OverlayRect, ipc_sock: PathBuf) -> anyhow::Result<()> { layer.set_anchor(zwlr_layer_surface_v1::Anchor::Top | zwlr_layer_surface_v1::Anchor::Left); layer.set_size(rect.w.max(1) as u32, rect.h.max(1) as u32); layer.set_exclusive_zone(-1); - // Margins encode the offset: with TOP+LEFT anchor, a positive top - // margin pushes the surface down; positive left pushes it right. - layer.set_margin(rect.y.max(0), rect.x.max(0), 0, 0); + // zwlr_layer_surface::set_margin is (top, right, bottom, left). + // With TOP+LEFT anchor: top margin pushes the surface down, left + // margin pushes it right. (Earlier versions of this code passed + // rect.x as the right margin, which is a no-op when only TOP+LEFT + // are anchored.) + layer.set_margin(rect.y.max(0), 0, 0, rect.x.max(0)); layer.set_keyboard_interactivity(zwlr_layer_surface_v1::KeyboardInteractivity::None); state.surface = Some(surface.clone()); state.layer_surface = Some(layer); @@ -463,7 +466,12 @@ impl Dispatch for OverlayState { && matches!(btn_state, wayland_client::WEnum::Value(wl_pointer::ButtonState::Pressed)) { send_swap(state.slot, &state.ipc_sock); - state.exited = true; + // NOTE: do not flip `state.exited = true` here. Doing so + // destroys the badge and `OverlayHub.by_slot` still holds + // the slot, so the hub refuses to respawn it (it thinks + // the slot is already served). The compositor's + // zwlr_layer_surface::Closed event is the only path that + // should tear down the live thread. } } }