3 ms·
I've mused that a solid "delayed clipboard clear" feature would do some kind of atomic Compare-And-Swap, because otherwise the originating program could conceiv
by frou_dh 9y ago
I've mused that a solid "delayed clipboard clear" feature would do some kind of atomic Compare-And-Swap, because otherwise the originating program could conceivably blow away something it didn't put there.
https://en.wikipedia.org/wiki/Compare-and-swap https://en.wikipedia.org/wiki/Compare-and-swap
- urld 9y agoGood point. Im going to implement this, although its probably not possible to make it an atomic operation.
- justtopostthis3 9y agoOn X11 you can do better: the clipboard isn't actually stored anywhere, the program requesting the paste gets the data directly from the program that claimed the clipboard. The clipboard lib you're using just spawns xclip (or xsel) on Unix. xclip has a -loops argument that is the maximum number of pastes. So you could just spawn: xclip -loops 1 -in -selection clipboard And the password would be available to paste exactly once. Unfortunately I don't think xsel has any such option. There are clipboard manager apps that could grab the paste immediately and persist it, but I'm not sure how common they are or if they are default anywhere.