summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/api/options.py1
-rw-r--r--ranger/defaults/options.py3
-rw-r--r--ranger/fsobject/file.py15
-rw-r--r--ranger/shared/settings.py1
4 files changed, 14 insertions, 6 deletions
diff --git a/ranger/api/options.py b/ranger/api/options.py
index ee947b39..aee6150b 100644
--- a/ranger/api/options.py
+++ b/ranger/api/options.py
@@ -17,3 +17,4 @@ import re
 from re import compile as regexp
 from ranger.api import *
 from ranger.gui import color
+from ranger import relpath, relpath_conf
diff --git a/ranger/defaults/options.py b/ranger/defaults/options.py
index 23752d97..feb02a58 100644
--- a/ranger/defaults/options.py
+++ b/ranger/defaults/options.py
@@ -39,6 +39,9 @@ hidden_filter = regexp(
 	r'^\.|\.(?:pyc|pyo|bak|swp)$|~$|lost\+found')
 show_hidden = False
 
+# Which script is used to generate file previews?
+preview_script = relpath('ext/preview.sh')  # relative to rangers path
+
 # Show dotfiles in the bookmark preview box?
 show_hidden_bookmarks = True
 
diff --git a/ranger/fsobject/file.py b/ranger/fsobject/file.py
index 25902f57..cd5b37ff 100644
--- a/ranger/fsobject/file.py
+++ b/ranger/fsobject/file.py
@@ -92,10 +92,13 @@ class File(FileSystemObject):
 		return True
 
 	def get_preview_source(self):
-		try:
-			p = Popen([relpath('ext/preview.sh'), self.path],
-					stdout=PIPE, stderr=devnull)
-			if not p.poll():
+		if self.fm.settings.preview_script:
+			try:
+				p = Popen([self.fm.settings.preview_script, self.path],
+						stdout=PIPE, stderr=devnull)
+				if p.poll():  # nonzero exit code
+					return None
 				return p.stdout
-		except:
-			return open(self.path, 'r')
+			except:
+				pass
+		return open(self.path, 'r')
diff --git a/ranger/shared/settings.py b/ranger/shared/settings.py
index f5d8614f..24aea39c 100644
--- a/ranger/shared/settings.py
+++ b/ranger/shared/settings.py
@@ -41,6 +41,7 @@ ALLOWED_SETTINGS = {
 	'tilde_in_titlebar': bool,
 	'max_history_size': (int, type(None)),
 	'max_console_history_size': (int, type(None)),
+	'preview_script': (str, type(None)),
 	'scroll_offset': int,
 	'preview_files': bool,
 	'preview_directories': bool,
into config.def.h, config.h will be created if not present, this seems less annoying after all' href='/acidbong/suckless/dwm/commit/Makefile?h=6.4&id=17d39ee01458025a5b9f5087168f258933f0ccd9'>17d39ee ^
e94774d ^

17d39ee ^
650a1fb ^
3d48f33 ^

1076f2b

4d55eee ^
db876f9 ^
dbf7e03 ^

4d55eee ^

d477fb6 ^
f806a17 ^
4d55eee ^


dbf7e03 ^

4d55eee ^
dbf7e03 ^
4d55eee ^


dbf7e03 ^
ad4962c ^
4d55eee ^
dbf7e03 ^

4d55eee ^



dc5c070 ^

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60