sdushantha / fontpreview

Highly customizable and minimal font previewer written in bash
MIT License
909 stars 39 forks source link

[Feature Request] Replace sxiv with überzug? #23

Closed sdushantha closed 3 years ago

sdushantha commented 4 years ago

I just learned from @Krasjet that you can use überzug to display the font preview right on the terminal! Which is AWESOME!

I was thinking that we could use fzf's preview window to display the font preview image. This means users wont have to press [ENTER], to view the font preview because fzf automatically displays the content in the preview window just by highlighting it.

This would also fix the issues (#12) many users we having with xdotool not working properly.

Also, using überzug would mean that everything would be in one window instead of having a separate window for the font preview.

@aeghn has made a PR(#13) to add keybindings to do certain action in fzf. So if we do add the überzug image preview, we can then quickly remove the image to display the help menu in fzf's preview window.

Let me know what you guys think!


PS. I cant work a lot on project for the next 2 weeks because I will be very busy, so if someone wants push access please do contact me :)

sdushantha commented 4 years ago

This would also fix #14 😁

vanillajonathan commented 4 years ago

Also note that sxiv is for X11 and now there is Wayland.

sdushantha commented 4 years ago

@vanillajonathan That is true! So using überzug would allow more users to use fontpreview :D

vanillajonathan commented 4 years ago

@sdushantha But unfortunately Überzug also depends on X11. 😢

sdushantha commented 4 years ago

@vanillajonathan Oh.... :(

I guess we would have to drop this idea for compatibility then. I know that imv supports both X11 and Wayland, we could use that if it supports reloading images when it gets modified.

sdushantha commented 4 years ago

@vanillajonathan When I think about it, we could let users chose between imv or überzug

vanillajonathan commented 4 years ago

imv natively supports Wayland so that is a plus.

sdushantha commented 4 years ago

Here are some useful scripts by @seebye: https://github.com/seebye/fzf-ueberzogen https://github.com/seebye/ueberzug/blob/master/examples/fzfimg.sh

maxdevjs commented 4 years ago

Both seem to be amazing tools. I have no personal experience, so... as both probably should be installed as dependency, perhaps not everyone will be comfortable with it. What is the easier to install? and maintain?

Example: I see that imv is an impressive tool, but no packages for Debian/derivatives. As per comments, a lot of people enjoying fontviewer used it on Ubuntu/derivatives.

SebastianMeisel commented 4 years ago

What about a variable IMAGE_VIEWER - it could default to sxiv, but you could use another image-viewer. Wouldn't work for Überzug however as it's a library and needs to be called differently.

On the other hand, all that is needed is a simple viewer to show the image and sxiv does the job.

Am Mo., 10. Feb. 2020 um 20:32 Uhr schrieb maxdevjs < notifications@github.com>:

Both seem to be amazing tools. I have no personal experience, so... as both probably should be installed as dependency, perhaps not everyone will be comfortable with it. What is the easier to install? and maintain?

Example: I see that imv https://github.com/eXeC64/imv is an impressive tool, but no packages for Debian/derivatives. As per comments, a lot of people enjoying fontviewer used it on Ubuntu/derivatives.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sdushantha/fontpreview/issues/23?email_source=notifications&email_token=ALURSNPV4GSDNYZAY2OARHLRCGTWRA5CNFSM4KSJ45IKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELJ54YA#issuecomment-584310368, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALURSNKJMW5O676ECAVIZI3RCGTWRANCNFSM4KSJ45IA .

Krasjet commented 4 years ago

ueberzug

I tried to play with fzf-ueberzogen and it seems that ueberzug works pretty well with fzf. I don't think we need fzf-ueberzogen though, since it is just a shellscript.

#!/usr/bin/env bash

function CREATE_PREVIEW {
    local path="$(realpath "$1")"
    if [ ! -d "/tmp${path}" ]; then
      mkdir -p "/tmp${path}"
    fi
    local cache_path="/tmp${path}.png"

    fontpreview -i "$path" -o "$cache_path"

    case "$?" in
        0) DRAW_PREVIEW "$cache_path" ;;
        1) CLEAR_PREVIEW ;;
    esac
}

if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
    export -f CREATE_PREVIEW
    exec fzf-ueberzogen.sh --preview 'CREATE_PREVIEW {}' "$@"
fi
Krasjet commented 4 years ago

By the way, the -i and -o options are from #20

seebye commented 4 years ago

I tried to play with fzf-ueberzogen and it seems that ueberzug works pretty well with fzf. I don't think we need fzf-ueberzogen though, since it is just a shellscript.

There is at least one difference just copying the example code requires the project to be relicensed to gplv3
while using fzf-ueberzogen.sh doesn't required it as you're just executing a gpl licensed program.
Also distribution the shell script though pip has the advantage of ueberzug beeing installed with it,
(but I guess that doesn't really matter as other programs are used like convert which I think aren't installed by default?).

xlucn commented 3 years ago

If anyone is interested, I just wrote a small script to preview fonts with ueberzug in fzf. The code is actually simpler without the hassle of handling another window (sxiv). Also it does not have issues like #24. It is a completely different script though which almost does not use any code from either fontpreview or fzf-ueberzogen. Thus I could only offer it as another solution instead of PR.

https://github.com/OliverLew/fontpreview-ueberzug

sdushantha commented 3 years ago

@OliverLew That is really awesome! I think your project is actually more useful than mine. I also really like how font preview blends with the terminal 👌

sdushantha commented 3 years ago

I am closing this issue as @OliverLew has achieved this with his fontpreview-ueberzug project. Since that project exists, I dont see the point of copying it and adding it to my version of fontpreview.