Closed CheerfulPianissimo closed 3 months ago
Apart from some stylistics nits which can be addressed later on this pr looks fine to me! Thanks for the contribution.
CC: @Decodetalkers Can I get your input on it too?
The way to circumvent this is to keep the process alive. wl-clipboard-rs's version of wl-copy for instance does some unsafe shenanigans to fork itself, disconnect stdin/stdout and maintains the image in-memory till some other process overwrites the clipboard: https://github.com/YaLTeR/wl-clipboard-rs/blob/10b35fb2699a0ff65888b1220804bb0c44b65e0f/wl-clipboard-rs-tools/src/bin/wl-copy.rs#L160 I believe this is the same thing wl-copy does. We'll also have to do something similar to achieve parity with the wayshot --stdout | wl-copy method.
I tried this out and found that it could be pretty easily done with the help of the fork crate: https://docs.rs/fork/latest/fork/ I'm not sure if the feature is worth adding yet another dependency for though. fork being unix specific doesn't appear in the stdlib so I can't see a way to do it without a dep. How should I proceed, should I commit the change here or should it be in a another branch/PR.
I think it's worth the dependency graph increase in this case. You can edit this pr itself.
Have added info about the wayshot persisting in background to the cli flag's description. Is there anything else that needs to be done here?
Oops, corrected the typo.
Thank you for your work!
Something I forgot to suggest but which can be done later - documentation ( the flag should've been explained for the users.)
As in the man pages? It is already documented in the CLI help. The man pages are entirely out of sync with the CLI changes in this branch. They will all have to be modified.
As in the man pages?
Yes
The man pages are entirely out of sync with the CLI changes in this branch. They will all have to be modified.
I am aware but incrementally fixing it while introducing the changes is ideal, I will rewrite the outdated docs anyways.
This PR adds a --clipboard flag and implements functionality to make the screenshot available on the clipboard using wl-clipboard-rs. All the caveats described in https://github.com/waycrate/wayshot/pull/89#issue-2151702439 are still applicable: