diff --git a/window/src/os/x11/window.rs b/window/src/os/x11/window.rs index cb26392ed..179207949 100644 --- a/window/src/os/x11/window.rs +++ b/window/src/os/x11/window.rs @@ -926,7 +926,12 @@ impl XWindowInner { conn.send_request_no_reply(&xcb::x::SetSelectionOwner { owner: xcb::x::Window::none(), selection, - time: self.copy_and_paste.time, + // We use CURRENT_TIME rather than self.copy_and_paste.time here, because that field + // only advances on key/button events on *this* window, so for a window that hasn't + // been interacted with recently it lags behind the selection's lastTimeChanged. + // The X server ignores SetSelectionOwner with time before lastTimeChanged, so + // clipboard updates without explicit interaction (OSC 52) would never be accepted. + time: xcb::x::CURRENT_TIME, })?; } else if we_own_it { log::trace!( @@ -937,7 +942,8 @@ impl XWindowInner { conn.send_request_no_reply(&xcb::x::SetSelectionOwner { owner: self.window_id, selection, - time: self.copy_and_paste.time, + // See note about CURRENT_TIME in the other branch above. + time: xcb::x::CURRENT_TIME, })?; } else { log::trace!(