Skip to content
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

Chafa works fine out of lf but not working properly in previews #1599

Closed
Fexxix opened this issue Feb 7, 2024 · 2 comments
Closed

Chafa works fine out of lf but not working properly in previews #1599

Fexxix opened this issue Feb 7, 2024 · 2 comments

Comments

@Fexxix
Copy link

Fexxix commented Feb 7, 2024

This is my lfrc

set sixel true
set previewer /home/fexxix/.config/lf/pv.sh

My preview script

#!/bin/sh

echo "Previewing file: $1"

case "$(file -Lb --mime-type -- "$1")" in
    image/*)
        echo "Converting image to Sixel"
        chafa -f sixel -s "$2x$3" --animate off --polite on "$1"
        exit 1
        ;;
    *)
        echo "Not an image file, displaying as text"
        cat "$1"
        ;;
esac

Chafa in terminal without lf

Screenshot from 2024-02-07 23-13-12

Chafa with lf

Screenshot from 2024-02-07 23-15-56

Distribution: Fedora 39
Terminal: Foot
Linux-kernel: 6.6.14-200.fc39.x86_64

Edit: It might be related to #1582 but notice that i have polite --on in my script already.

Edit 2: No it's prolly not, my current chafa version is 1.10.3

Edit 3: I updated my chafa to 1.15.0 and the issue still the same.

@Michael-Gallo
Copy link
Contributor

It seems to be the echo lines, I see the same output you do with your script as written and with this script it previews images successfully.

#!/bin/sh

case "$(file -Lb --mime-type -- "$1")" in
    image/*)
        chafa -f sixel -s "$2x$3" --animate off --polite on "$1"
        exit 1
        ;;
    *)
        echo "Not an image file, displaying as text"
        cat "$1"
        ;;
esac

@Fexxix
Copy link
Author

Fexxix commented Feb 9, 2024

It seems to be the echo lines, I see the same output you do with your script as written and with this script it previews images successfully.

#!/bin/sh

case "$(file -Lb --mime-type -- "$1")" in
    image/*)
        chafa -f sixel -s "$2x$3" --animate off --polite on "$1"
        exit 1
        ;;
    *)
        echo "Not an image file, displaying as text"
        cat "$1"
        ;;
esac

BRUH. I added those lines for debugging purposes, but it was the problem. Initially, I copied the script directly from the docs and that had an echo in it too. They should remove that.

@Fexxix Fexxix closed this as completed Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants