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

image preview feature not work in OSX #864

Closed
tanrax opened this issue May 11, 2017 · 35 comments
Closed

image preview feature not work in OSX #864

tanrax opened this issue May 11, 2017 · 35 comments

Comments

@tanrax
Copy link

tanrax commented May 11, 2017

ISSUE TYPE

  • Bug report

RUNTIME ENVIRONMENT

  • Operating system and version: macOS Sierra 10.12.4
  • Terminal emulator and version: ITerm2 3.0.14
  • Python version: Python 2.7.10
  • Ranger version/commit: ranger-stable 1.8.1

Python 2.7.10 (default, Feb 6 2017, 23:53:20)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)]

  • Locale:

EXPECTED BEHAVIOR

Preview images

CURRENT BEHAVIOR

No pictures are shown

CONTEXT

POSSIBLE SOLUTIONS

STEPS TO REPRODUCE

  1. I added my rc.conf
set preview_images true
set preview_images_method iterm2

  1. Open ranger

TRACEBACK


IMAGES / VIDEOS

@nfnty
Copy link
Member

nfnty commented May 14, 2017

Have you tested running on master?

@tanrax
Copy link
Author

tanrax commented May 14, 2017

Yes. Same results

@tanrax
Copy link
Author

tanrax commented May 14, 2017

screen shot 2017-05-14 at 18 00 06

@mlopes
Copy link

mlopes commented May 20, 2017

I think I may have some extra information that might help here. I thought it didn't work for me but turns out it does... but only for images smaller than around 42k. Anything bigger than that doesn't get a preview.
See the attached screenshots:
image

Now an image bigger than 42k:

image

I was able to reproduce this consistently.

@tanrax
Copy link
Author

tanrax commented May 22, 2017

I can not see it.
screen shot 2017-05-22 at 16 47 27
screen shot 2017-05-22 at 16 48 19

How can I give you more information? Thank you

@Wes974
Copy link

Wes974 commented Jul 16, 2017

I found a way to make it work.
Copy the folder ~/.config/ranger/ somewhere on your computer (your Desktop for example) then remove everything in ~/.config/ranger/.

Open iTerm and run this command :

ranger --copy-config=all

Once this is done, open your ~/.config/ranger/rc.conf file to edit those line

set preview_images true
set preview_images_method iterm2

Let me know if it worked for you.

@tanrax
Copy link
Author

tanrax commented Jul 16, 2017

It does not work for me. What version of python do you use?

@Wes974
Copy link

Wes974 commented Jul 16, 2017

I use python 2.7.13. If you can try to use this version to see if it changes something.

@tanrax
Copy link
Author

tanrax commented Jul 16, 2017

I followed your steps, with both the brew version and the master version with no results. :(

@Wes974
Copy link

Wes974 commented Jul 16, 2017

All right we can try another thing, in your rc.conf, find this line :

set draw_borders false

Set it to true and relaunch ranger. See if it changes something.

@tanrax
Copy link
Author

tanrax commented Jul 16, 2017

screen shot 2017-07-16 at 22 16 37
screen shot 2017-07-16 at 22 16 34
screen shot 2017-07-16 at 22 16 28
screen shot 2017-07-16 at 22 16 22

@Wes974
Copy link

Wes974 commented Jul 16, 2017

Hey are you running ranger inside of tmux by any chance ?

@tanrax
Copy link
Author

tanrax commented Jul 17, 2017

I try everything in and out of Tmux.

@Wes974
Copy link

Wes974 commented Jul 17, 2017

Well then I don't know what to do, sorry

@looneym
Copy link

looneym commented Mar 13, 2018

Howdy. I'm using ranger in tmux and the image preview doesn't work. Works outside of tmux but I sure would like it if it worked inside of it. I followed the steps mentioned here but no luck #864 (comment)

If anyone has any ideas as to why tmux might break this please let me know!

@toonn
Copy link
Member

toonn commented Mar 13, 2018

@looneym tmux is a lot more limited than regular terminals in what it can do I don't think it supports any of the previewing methods.
@tanrax Do you still have this issue?

@tanrax
Copy link
Author

tanrax commented Mar 13, 2018

@toonn I didn't get it to work... the problem persists.

@toonn
Copy link
Member

toonn commented Mar 13, 2018

Could you remove your scope.sh and comment out the line set preview_script ~/.config/ranger in rc.conf? Don't try in tmux it won't work. Also make sure you're running the latest version of ranger 1.9.1.

@tanrax
Copy link
Author

tanrax commented Mar 13, 2018

@toonn I don't have any scope.sh
rc.conf
screen shot 2018-03-13 at 18 42 59
screen shot 2018-03-13 at 18 41 51

@tanrax
Copy link
Author

tanrax commented Mar 13, 2018

ohh!
screen shot 2018-03-13 at 18 44 42

@toonn
Copy link
Member

toonn commented Mar 14, 2018

Did you comment out or remove the set preview_script line? And try running ranger with the --debug flag, might give us some more info.

@BenBergman
Copy link

I have image previews working for me in iterm2 both in and out of tmux, but if I am inside tmux I can only preview images that are under ~85k. Is there any setting I can add to make it work better in tmux?

@toonn
Copy link
Member

toonn commented Apr 14, 2018

Not that I know of sadly.

@jsatk
Copy link

jsatk commented Dec 21, 2018

I'm in the exact same boat as @tanrax. I just tried everything listed in here. Nothing works. I just get prompted to "open with". @Wes974's comment here installed a bunch of new stuff I didn't have in ~/.config/ranger, but it didn't fix my problem.

@jsatk
Copy link

jsatk commented Dec 28, 2018

@BenBergman any chance you could share what your config looks like? I'm in tmux + iTerm as well.

@jsatk
Copy link

jsatk commented Dec 28, 2018

@toonn This is the entirety of my ~/.config/ranger.rc.conf.

# https://github.com/ranger/ranger/wiki/Image-Previews#with-iterm2
set preview_images true
set preview_images_method iterm2

And my ~/.config/ranger/rifle.conf is the exact default one with this single line added.

mime ^image, flag f = open -- "$@" # Open images in Preview.app on macOS.

@jsatk
Copy link

jsatk commented Dec 28, 2018

Update — the above does work in iTerm 2. It just doesn't work in tmux + iTerm 2. As said a few times in this issue, it's anticipated that image preview won't work in tmux. If anyone knows how to get it to work I'm all ears, but as far as I'm concerned this issue is resolved for me since it is working in iTerm 2 and has been explicitly stated that it won't work in tmux.

@BenBergman
Copy link

@jsatk Here is my ~/.config/ranger/rc.conf: https://gist.github.com/BenBergman/f95a558c3f73c90222639dc4f215f448

That file was either auto generated or I stole it from somewhere as I don't recall ever editing it before, at least not all of those lines.

I also tossed in my .tmux.conf in case there is anything helpful in there. That one is more handcrafted by me.

In case it is relevant, I also use zsh instead of bash.

@toonn
Copy link
Member

toonn commented Dec 18, 2019

I'm closing this in the hope that #1601 fixed it.

@toonn toonn closed this as completed Dec 18, 2019
@hawkinchina
Copy link

I meet the same problem. it works outside of tmux, but inside tmux, it cannot work. this issue has already fixed, or not ?

@toonn
Copy link
Member

toonn commented Jan 9, 2020

Yes, but I doubt you're running 1.9.3 already?

@hawkinchina
Copy link

my ranger‘s version: 1.9.3

➜ /Users/jack >ranger --version
ranger version: ranger 1.9.3
Python version: 3.7.5 (default, Nov 1 2019, 02:16:38) [Clang 10.0.0 (clang-1000.11.45.5)]
Locale: zh_CN.UTF-8

@toonn
Copy link
Member

toonn commented Jan 10, 2020

Then you're probably trying to preview "large" images. Tmux prevents images larger than a couple kB from being shown. Nothing we can do about that.

@ayushkumarshah
Copy link

ayushkumarshah commented May 23, 2020

I found a way to make it work.
Copy the folder ~/.config/ranger/ somewhere on your computer (your Desktop for example) then remove everything in ~/.config/ranger/.

Open iTerm and run this command :

ranger --copy-config=all

Once this is done, open your ~/.config/ranger/rc.conf file to edit those line

set preview_images true
set preview_images_method iterm2

Let me know if it worked for you.

Thank @Wes974. It works perfectly. However, it asked me permission to allow download of files by iterm2. Does this method download images somewhere?

@toonn
Copy link
Member

toonn commented May 23, 2020

Maybe iTerm2 doesn't include the imgcat functionality necessary for the previews but is able to download it automatically? No idea though, never heard of this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants