about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorEmanuel Guevel <guevel.emanuel@gmail.com>2013-02-03 15:27:55 +0100
committerEmanuel Guevel <guevel.emanuel@gmail.com>2013-02-03 15:27:55 +0100
commitb4eb9dbeea3fb98c8a7b4795aa52b164580d52eb (patch)
tree4e4fbfc462496347762f634c7c839fe79c1c64df
parentf826fd47ac40f920cf84de8158edb6458afdf892 (diff)
downloadranger-b4eb9dbeea3fb98c8a7b4795aa52b164580d52eb.tar.gz
Allow to pass custom options to w3mimgdisplay
Can be useful to change image display offset or adapt to term
background color.

See http://w3m.cvs.sourceforge.net/viewvc/w3m/w3m/doc/README.img for
available options.
-rw-r--r--ranger/ext/img_display.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/ranger/ext/img_display.py b/ranger/ext/img_display.py
index 277d32ce..2db7d0e7 100644
--- a/ranger/ext/img_display.py
+++ b/ranger/ext/img_display.py
@@ -13,6 +13,7 @@ import termios, fcntl, struct, sys
 from subprocess import Popen, PIPE
 
 W3MIMGDISPLAY_PATH = '/usr/lib/w3m/w3mimgdisplay'
+W3MIMGDISPLAY_OPTIONS = []
 
 def _get_font_dimensions():
 	"""
@@ -31,8 +32,8 @@ def _w3mimgdisplay(commands):
 	"""
 	Invoke w3mimgdisplay and send commands on its standard input.
 	"""
-	process = Popen(W3MIMGDISPLAY_PATH, stdin=PIPE, stdout=PIPE,
-			universal_newlines=True)
+	process = Popen([W3MIMGDISPLAY_PATH] + W3MIMGDISPLAY_OPTIONS, stdin=PIPE,
+			stdout=PIPE, universal_newlines=True)
 
 	# wait for the external program to finish
 	output, _ = process.communicate(input=commands)