Open michael-lazar opened 8 years ago
Assuming you merge the image branch I seen to the main, I'd love a reminder to add w3m to opt depends for aur package. (once a release is made ofc)
Yea no problem! It will definitely be an optional setting that will be disabled by default.
BTW do you want to add something to the README about installing on Arch?
Made PR #215. Not entirely sure what level of detail to cover. Since aur packages arent the same as a "native" package. Feel free to poke at any of the wording. But I think it covers the basics. I'd be happy to change anything.
Thanks! I moved a few words around to make it more concise but I tried to keep all of your information in there.
I was planning around to uses feh
to open direct links of imagens, getting it almost done to ask how it goes for a PR ( diff here as a keep working on it), but playing with w3m would be a much better solution.
Hi Ziul. I'm making progress with this branch, check it out!
Unfortunately I think that the w3m approach is limited because it's not supported on most terminals. Because of that I'm sticking with just thumbnails for now.
Nice! Is there a flag to enable/disable the use of w3m? From rtv.cfg
you could get $TERM
and check if it's in a whitelist (or not in a blacklist). But the thumbnails looks great!
I don't think a white or blacklist appraoch is ideal. Rather a feature toggled on/off. Some terminals work, some don't. But it's still a random thing. Ranger users would tell you that it's hit and miss but never set in stone.
I use ranger and can confirm that. Although I had partial success with ascii view for images in gnome-terminal.
For me urxvt, and xterm are capable of displaying images in the terminal. gnome-terminal
doesn't. However, I still stick with gnome-terminal
for its font support.
@michael-lazar how is going with w3m? I didn't found any environment variable that i could use to call the default image viewer of the user, so i'll set the feh
as default on a terrible hard way (xdg-open
opens the image with browser. Looks like display
can do the trick and is more common than feh
, but well... w3m
however looks like opens my default image viewer so would be a nice choice, but for it i would wait you to complete. Anyway, i'm letting the PR (#223) opened.
@Ziul I'll admit that I haven't worked on this lately. It will probably be a while (until I get another burst of motivation) before the w3m stuff gets in. In the mean time, thanks for the PR. I'll go over it and try to get back to you with comments after Memorial Day. As for the default program, @masochist suggested using mailcap here (https://github.com/michael-lazar/rtv/issues/78). I haven't tested it thoroughly but you can do something like this
import tempfile
import mailcap
import mimetypes
url = 'http://i.imgur.com/RTMUoFo.png'
mimetype = mimetypes.guess_type(url)[0]
print mimetype
d = mailcap.getcaps()
m = mailcap.findmatch(d, mimetype, 'view', url)
print m[0]
and for me it prints
image/png
feh 'http://i.imgur.com/RTMUoFo.png'
Great! mailcap
was giving me None
, but i did some research and found a work around using part of the answer and the xdg library! Soon i should update the PR with a more generic method. Probably it will offer a option to use vlc
on videos too.
@michael-lazar Any ETA on when we can see the w3m-image-preview
branch released? I'm really looking forward to it :+)
Is this dead?
No, but there has been no significant work on it in a few years and no timeline to get it in pushed in at this point.
Anyone is welcome to step in and work on updating the branch, but it would be significant work merging in master and fixing/testing all of the different browser edge cases.
Hi there I'm glad I see this thread - sort of tho.
It would be really amazing to have image previews because like a half of whole Reddit is image based content. People usually scan the list of threads by eyes pinned onto thumbnails and if they like what they see go onto the thread detail page.
This missing feature is basically one and only thing which is blocking me (and I guess a lot of the others) from switching gtom browser to cli in terms of Reddit.
Althought I already tried to help once with images for a CLI app but sadly got no feedback. From what I know so far (my investigation + info from ranger developer) images in terminal are not easy at all. But once basically any CLI app can solve this we can finally kick asses to those Electron memory-consuming and node-shit apps.
Just gonna add to this, even though it seems like it may be dead. The kitty terminal supports viewing images natively, without using w3m. It would be wonderful if we could have support for multiple image rendering backends. Personally I prefer kitty, but it would only be available in the kitty terminal.
I was poking around ranger's source code and there's an extension module (https://github.com/hut/ranger/blob/master/ranger/ext/img_display.py) that apparently makes this incredibly easy.