I cannot find how to make it work, simply have no idea.
There is a script on GitHub, but it doesn’t work for me:
Add the following to your ~/.config/ranger/commands.py
:
from subprocess import Popen, PIPE, run
import time
@register_image_displayer("imv")
class IMVImageDisplayer(ImageDisplayer):
"""
Implementation of ImageDisplayer using imv
"""
is_initialized = False
def __init__(self):
self.process = None
def initialize(self):
""" start imv """
if (self.is_initialized and self.process.poll() is None and
not self.process.stdin.closed):
return
self.process = Popen(['imv'], cwd=self.working_dir,
stdin=PIPE, universal_newlines=True)
self.is_initialized = True
time.sleep(1)
def draw(self, path, start_x, start_y, width, height):
self.initialize()
run(['imv-msg', str(self.process.pid), 'close'])
run(['imv-msg', str(self.process.pid), 'open', path])
def clear(self, start_x, start_y, width, height):
self.initialize()
run(['imv-msg', str(self.process.pid), 'close'])
def quit(self):
if self.is_initialized and self.process.poll() is None:
self.process.terminate()
Ensure the following lines appear in your ~/.config/ranger/rc.conf
:
set preview_images true
set preview_images_method imv
set use_preview_script true
set preview_script ~/path/to/your/scope.sh # or whatever your preview script is