-
-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rofi (custom mode with images) really slow #116
Comments
is it possible to just add the chars for icon to the list command like cliphist list --image, so we don't need to use regex etc to make it slower |
My guess this one makes it significantly slow Every call for the clipboard removes the images, then adds it again. |
Yes i know that is the one that made it slow(as specified in title) i proposed a solution too. In case anyone wanna implement it to be faster |
For now, I will be using this. Having the images handled by cliphist is a great idea #!/usr/bin/env bash
tmp_dir="/tmp/cliphist"
mkdir -p "$tmp_dir"
if [[ -n "$1" ]]; then
cliphist decode <<<"$1" | wl-copy
exit
fi
read -r -d '' prog <<EOF
/^[0-9]+\s<meta http-equiv=/ { next }
/\[ binary/ {
if (match(\$0, /^([0-9]+)\s(\[\[\s)?binary.*(jpg|jpeg|png|bmp)/, grp)) {
file_path = "$tmp_dir/" grp[1] "." grp[3]
if (system("[ -f " file_path " ]") != 0) {
system("echo " grp[1] "\\\\\t | cliphist decode >" file_path)
}
print \$0"\0icon\x1f" file_path
next
}
}
1
EOF
cliphist list | gawk "$prog" |
@littleblack111 Something like this ? |
No. Maybe generate something like the original script, the benefit of this is not needing to pipe it to the program again everytime of an image, since it can be grabbed internally. And prob add an option to put them(like in the script it’s /tmp, maybe default to that)so u can: cliphist -show-image then pipe it to rofi Sorry im on vacation rn, will get back to u with a more detailed explanation |
Like this ? @littleblack111 |
Yes that would be it. How’s the performance? Thank you! |
Thank you! |
@littleblack111 BTW, I needed some few suggestions regarding on how we should interface this. I think it's odd if it only supports rofi. One can write a lightweight clipboard implementation using cliphist with image preview etc. -image <delimeter string> export and list the images to the target directory plus add the delimiter string
-image-dir <target/dir> optional directory, This is optional as I was thinking screenshots are confidential so they might want to safe keep it somewhere. default: /tmp/cliphist Also, performance is improved by just creating the file if not yet existed. |
Yes that’s true. That should work. |
Can you test the patch?
|
yep, this is amazing. had to do a pipe to head -n 100 to achieve the same performance with original script |
its way slower then the normal dmenu one... why.
The text was updated successfully, but these errors were encountered: