diff --git a/.agents/CLIPBHOARD_HARDENING_CHECKLIST.md b/.agents/CLIPBHOARD_HARDENING_CHECKLIST.md index ec0d48d..08cca75 100644 --- a/.agents/CLIPBHOARD_HARDENING_CHECKLIST.md +++ b/.agents/CLIPBHOARD_HARDENING_CHECKLIST.md @@ -61,11 +61,12 @@ Each bounded iteration must: - [ ] Make popup close hide the window while the background process continues (code path added; desktop verification pending). - [ ] Center the popup on the configured/active monitor. -- [x] Keep the X11 popup above other windows and apply 30% opacity while it is - inactive, returning to full opacity when focused; recheck after mapping and - every 100 ms to cover Cinnamon/GTK4 focus-notification races (27 X11-feature - tests and Docker GTK/X11/package build, 2026-09-12); compositor behavior - remains live desktop evidence. +- [x] Keep the X11 popup above other windows and apply 40% opacity while it is + inactive, returning to full opacity when focused; request `_NET_WM_STATE_ABOVE` + through the EWMH client-message protocol as well as the property, and recheck + opacity after mapping/every 100 ms (27 X11-feature tests and Docker + GTK/X11/package build, 2026-09-12); compositor behavior remains live desktop + evidence. - [x] Preserve search query and surviving selection after refresh-triggering actions (17 core tests and Docker GTK/X11 build, 2026-09-10). - [ ] Keep keyboard pause state synchronized with button and status text. - [ ] Implement complete keyboard-first navigation and commands. diff --git a/src/platform/linux/x11_window.rs b/src/platform/linux/x11_window.rs index 96bdd3b..fa54dcd 100644 --- a/src/platform/linux/x11_window.rs +++ b/src/platform/linux/x11_window.rs @@ -1,11 +1,15 @@ use gtk4::{prelude::*, ApplicationWindow}; use x11rb::{ - connection::Connection, protocol::xproto::ConnectionExt as X11ConnectionExt, + connection::Connection, + protocol::xproto::{ + ClientMessageData, ClientMessageEvent, ConnectionExt as X11ConnectionExt, EventMask, + CLIENT_MESSAGE_EVENT, + }, wrapper::ConnectionExt as X11WrapperExt, }; const ACTIVE_OPACITY: f64 = 1.0; -const INACTIVE_OPACITY: f64 = 0.30; +const INACTIVE_OPACITY: f64 = 0.40; pub fn configure(window: &ApplicationWindow) { set_active_opacity(window); @@ -16,7 +20,7 @@ pub fn configure(window: &ApplicationWindow) { tracing::debug!("popup window is not backed by an X11 surface"); return; }; - let xid = surface.xid(); + let xid = surface.xid() as u32; let Ok((connection, _)) = x11rb::connect(None) else { tracing::warn!("could not connect to X11 to keep popup above other windows"); return; @@ -35,13 +39,35 @@ pub fn configure(window: &ApplicationWindow) { }; if let Err(error) = connection.change_property32( x11rb::protocol::xproto::PropMode::REPLACE, - xid as u32, + xid, state.atom, x11rb::protocol::xproto::AtomEnum::ATOM, &[above.atom], ) { tracing::warn!(%error, "could not mark popup as always on top"); } + let root = connection.setup().roots[0].root; + let event = ClientMessageEvent { + response_type: CLIENT_MESSAGE_EVENT, + format: 32, + sequence: 0, + window: xid, + type_: state.atom, + data: ClientMessageData::from([1, above.atom, 0, 0, 0]), + }; + match connection.send_event( + false, + root, + EventMask::SUBSTRUCTURE_REDIRECT | EventMask::SUBSTRUCTURE_NOTIFY, + event, + ) { + Ok(cookie) => { + if let Err(error) = cookie.check() { + tracing::debug!(%error, "window manager rejected always-on-top request"); + } + } + Err(error) => tracing::debug!(%error, "could not send always-on-top request"), + } let _ = connection.flush(); }