summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2013-03-24 22:45:24 +0100
committerhut <hut@lavabit.com>2013-03-24 22:45:24 +0100
commite71e0931a09ee71729582dd99a9a9c2eb987876b (patch)
tree396f0f3330f321e1b1428c7c65d9edee0fbbb294 /ranger
parent4b3b9e594faf539d96814bfca605405dce7d8086 (diff)
downloadranger-e71e0931a09ee71729582dd99a9a9c2eb987876b.tar.gz
ext.img_display: allow using W3MIMGDISPLAY_PATH env var
in response to https://savannah.nongnu.org/bugs/?38582
Diffstat (limited to 'ranger')
-rw-r--r--ranger/ext/img_display.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/ranger/ext/img_display.py b/ranger/ext/img_display.py
index 9f2fd316..b6f59f4f 100644
--- a/ranger/ext/img_display.py
+++ b/ranger/ext/img_display.py
@@ -10,7 +10,7 @@ framebuffer) or in a Xorg session.
 w3m need to be installed for this to work.
 """
 
-import termios, fcntl, struct, sys
+import termios, fcntl, struct, sys, os
 from subprocess import Popen, PIPE
 
 W3MIMGDISPLAY_PATH = '/usr/lib/w3m/w3mimgdisplay'
@@ -32,7 +32,10 @@ def _get_font_dimensions():
 
 def _w3mimgdisplay(commands):
     """Invoke w3mimgdisplay and send commands on its standard input."""
-    process = Popen([W3MIMGDISPLAY_PATH] + W3MIMGDISPLAY_OPTIONS, stdin=PIPE,
+    path = os.environ.get("W3MIMGDISPLAY_PATH", None)
+    if not path:
+        path = W3MIMGDISPLAY_PATH
+    process = Popen([path] + W3MIMGDISPLAY_OPTIONS, stdin=PIPE,
             stdout=PIPE, universal_newlines=True)
 
     # wait for the external program to finish