-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Clipboard history truncates when copying image from browser #3
Comments
That is the expected behavior. The Let's say, we I currently have this in my clipboard: and i wanna get the first image. To do that, i will do: rustyclip get 1. This will return two things:
Example:
Then, you can do something like: Here is an example script that does all of that for you: #!/bin/bash
RUSTYCLIP=/path/to/rustyclip
PICKER=fuzzel
WLCOPY=wl-copy
NOTIFY_SEND=notify-send
# List clipboard entries and select one using a picker (fuzzel in this example)
output=$($RUSTYCLIP list | $PICKER -d| $RUSTYCLIP get)
# Extract the file path and MIME type from the output
file_path=$(echo "$output" | head -n 1)
mime_type=$(echo "$output" | tail -n 1)
# Check if the file exists and MIME type is non-empty
if [[ -f "$file_path" && -n "$mime_type" ]]; then
# Copy the file content to the clipboard with the specified MIME type
$WLCOPY -t "$mime_type" < "$file_path"
# Notify the user
$NOTIFY_SEND "Copied to clipboard" -t 500
fi Note: Replace the |
As for the issue with the HTML entry, you can get rid of it by explicitly telling wl-paste what to watch for: wl-paste -t text/plain --watch /path/to/rustclip store
wl-paste -t image --watch /path/to/rustclip store This will watch for images and plain text. |
Please et me know if you have questions or issues. |
Not sure if I understand this correctly, but shouldn't my previous entries stay the same, while copied image show at the top of the index? Like: ❯ rustyclip list
1: [[binary data 9.20 KB png 64x64]]
2: ❯ rustyclip list1: wl-paste -t image --watch rustyclip store &\ wl-paste -t text --watch rustyc
3: wl-paste -t image --watch rustyclip store &\ wl-paste -t text --watch rustyclip store Instead of this it seems like copying image deletes all previous history (like in ❯ rustyclip list
1: [[binary data 9.20 KB png 64x64]]
Yeah, I'm using this script from the
This was in my config before I noticed that emojis preserve as unicode codepoints instead of actual emojis. Is there any way to preserve those? |
After doing some testing, I was able to recreate the emoji issue. Instead of watching for mime type text/plain, watch for As for the clipboard items clearing after copying images from firefox, I had the same issue and I will figure out what is causing it. For now, just make sure you use the "text/plain;charset=utf-8" mime type instead. It solved the issue with emojis and the clipboard being cleared after copying images. wl-paste -t "text/plain;charset=utf-8" --watch /path/to/rustclip store
wl-paste -t image --watch /path/to/rustclip store Let me know if it fixed the issue or not. |
Yep, that fixes it. Many thanks! On a related note, with these commands in my configuration.. wl-paste -t 'text/plain;charset=utf-8' --watch /usr/local/bin/rustclip store
wl-paste -t image --watch /usr/local/bin/rustclip store ..I cannot reproduce the issue with erasing history when copying the image 🤔 |
Yeah, same here. I will have to do some more debugging to figure out why it was fixed (when using the new config) and what was causing it before. Thanks for reporting the issues! |
Software
Steps to reproduce
Execute the following:
wl-paste -t image --watch rustyclip store &\ wl-paste -t text --watch rustyclip store
Copy text from the Firefox. For example, the commands above.
Show clipboard:
Copy image from the Firefox. For example, my Github profile image.
Observe that clipboard history was truncated:
Also, sometimes when copying the image, another entry shows up with HTML content:
The text was updated successfully, but these errors were encountered: