Replies: 1 comment 1 reply
-
        
 I think the current mpv policy on wayland is to avoid compositor or application specific handlings like this. 
 This cannot be done because clipboard is accessed through properties and property access is always synchronous and happens in main player thread. Any delay in property access will cause the player to lock up. Async access to clipboard would require new commands. 
 
  | 
  
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Background: I've started using
wl-copy --paste-oncerecently, and it took me a while to figure out that it stopped working when mpv was running because mpv was reading my passwords.So, for passwords specifically there's a thing with
x-kde-passwordManagerHint-- if there's an offer with this mime type, mpv could ignore the update; it's probably not too hard to do, I might send a PR for it if it makes sense, and I'll be mostly happy...But even for non-passwords I'm not sure I like the way this works, reading everything I could select (primary selection) or copy... One problem for example is that mpv will read data one chunk at a time and remember it all so I could just make a client streaming infinite data and crash mpv.
First, to make sure I understand why we're reading the clipboard on every update even if nothing uses it, I guess it's to avoid blocking whatever handled a key binding, as reading data from clipboard is easy to hang if the sender just doesn't send data when requested, so instead of e.g. hitting
ctrl-vand then getting stuck only that background clipboard thread would get stuck and the previous data would still be available and all is well...?I would have suggested only getting data if there's focus (or a lua script requesting clipboard if possible), but if there's no output we just can't tell if there's focus... I guess we could limit the buffer size we're reading in
get_selection_data()? I'm frankly inclined to think I'd just prefer mpv to request data when hitting ctrl-v and sod it if the last offer came from a badly behaved client (perhaps with a timeout?)...Or could the keybind trigger fetching data from background thread and have a callback from said thread handle adding to playlist or calling into lua?...
Anyway it's getting late for me and I'm losing focus; first thing first I'll open a PR with the x-kde-passwordthing in the next few days unless someone screams not to.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions