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

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

Closed
sdushantha opened this issue Feb 10, 2020 · 16 comments
Closed

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

sdushantha opened this issue Feb 10, 2020 · 16 comments
Labels
enhancement New feature or request

Comments

@sdushantha
Copy link
Owner

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 sdushantha added the enhancement New feature or request label Feb 10, 2020
@sdushantha sdushantha changed the title Replace sxiv with überzug? [Feature Request] Replace sxiv with überzug? Feb 10, 2020
@sdushantha
Copy link
Owner Author

This would also fix #14 😁

@vanillajonathan
Copy link

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

@sdushantha
Copy link
Owner Author

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

@vanillajonathan
Copy link

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

@sdushantha
Copy link
Owner Author

@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
Copy link
Owner Author

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

@vanillajonathan
Copy link

imv natively supports Wayland so that is a plus.

@sdushantha
Copy link
Owner Author

@maxdevjs
Copy link
Contributor

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
Copy link
Contributor

SebastianMeisel commented Feb 10, 2020 via email

@Krasjet
Copy link
Contributor

Krasjet commented Feb 10, 2020

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
Copy link
Contributor

Krasjet commented Feb 10, 2020

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

@seebye
Copy link

seebye commented Feb 11, 2020

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
Copy link

xlucn commented Aug 7, 2020

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
Copy link
Owner Author

@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
Copy link
Owner Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

7 participants