9

I like the image-preview in ranger, but I also like my terminal transparent.

Is there really no way to get the image-preview work with w3m and transparent background? (I'm willing to change my terminal-emulator if that's necessary, currently urxvt)

makim
  • 563
  • 2
  • 11
  • 31

2 Answers2

4

Not sure what terminal you're using but if it's using a bit-depth of 32 or higher then it won't work.

excerpt - Images in terminal

Side note: w3m can't render images in urxvt, if the depth is 32. That means that you can't render images on a transparent background. Be sure that you comment the line URxvt*depth: 32 in your ~/.Xresources.

This thread also discussed it as well: - w3m/ranger images don't work on urxvt.

excerpt

It doesn't work with transparent terminals. I always make a shortcut for a "special ranger terminal" that has transparency disabled.

slm
  • 363,520
  • 117
  • 767
  • 871
  • 1
    any update on this issue as of today? at least an alternative to `w3mimagedisplay`? – villasv Aug 21 '16 at 15:46
  • 1
    [Ranger 1.7.2 with urxvt 9.22 transparent has image preview](http://pic.al/Pkf.jpg). That's with ranger default configuration `set preview_images true`, `set preview_images_method w3m` and urxvt *Native* transparency. It even works in tmux but only for an instant :) – tuk0z Aug 30 '16 at 17:42
4

I have a transparent terminal that works with ranger's image preview. I use termite (terminal emulator) and compton (compositor) for transparency (a nice combo when you use i3wm).

Here's the result:

enter image description here

The only problems I had were with tmux (images are displayed, but not always at the right position and sometimes the terminal needs to be refreshed).

Note that the text and the image are also transparent since transparency is handled by compton. This only works if you don't add too much transparency, else you need a terminal emulator that handles transparency and works with this feature (I tried with terminator and I did not work for instance, same for urxvt). 85% opacity gives me some transparency and good readability, so this setup works for me.

Update

True transparency is supported once again in termite, but it suffers from the same issues as urxvt when you enable transparency (failed to execute w3mimgdisplay error, cf. @slm's answer).

BenC
  • 1,081
  • 8
  • 11
  • It was so simple^^ just put `opacity-rule = ["85:class_g = 'Termite'"];` in the compton config file :-) thank's I couldn't be happier – makim Aug 17 '14 at 15:40
  • Oh just one Question, how did you get the text non-transparent? – makim Aug 17 '14 at 17:24
  • The text follows the same transparency rule since `compton` has no way to distinguish text from the rest, it only handles windows. If you want way more transparency, then you need a terminal that takes care of transparency itself (like `terminator`) while working with this feature (`terminator` doesn't iirc). In my case, I want a dark background for readability so this setup works pretty well for me, and it is much lighter than alternatives I used before. – BenC Aug 25 '14 at 11:48
  • Also, since I'm using `vim`, I have an extra `compton` rule that sets the opacity to 100% when I'm editing files in `vim`. – BenC Aug 25 '14 at 11:56
  • How ir-relevant is this one: https://lists.gnu.org/archive/html/ranger-users/2013-06/msg00003.html? Will there be a working image preview in ranger within from `Konsole` for example? – Nikos Alexandris Aug 30 '16 at 11:18