summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2012-01-18 16:21:20 +0100
committerhut <hut@lavabit.com>2012-01-18 16:21:20 +0100
commitc2b71f721ba4fec22e6b8135508e07cb56df3320 (patch)
tree1ec8c15bdfd7b82ec2b48fcb0fd345c24b0620f8 /ranger
parent1cc4c0e4c2a022d64dac2d380729ffacb2cfa31c (diff)
downloadranger-c2b71f721ba4fec22e6b8135508e07cb56df3320.tar.gz
Added doc for TERMCMD and integrated it in commands.py
Diffstat (limited to 'ranger')
-rw-r--r--ranger/core/runner.py4
-rw-r--r--ranger/defaults/commands.py5
2 files changed, 8 insertions, 1 deletions
diff --git a/ranger/core/runner.py b/ranger/core/runner.py
index ba6d82a8..17cdcca5 100644
--- a/ranger/core/runner.py
+++ b/ranger/core/runner.py
@@ -204,7 +204,9 @@ class Runner(object):
 		if 't' in context.flags:
 			if 'DISPLAY' not in os.environ:
 				return self._log("Can not run with 't' flag, no display found!")
-			term = os.environ['TERMCMD'] if 'TERMCMD' in os.environ  else os.environ['TERM']
+			term = os.environ.get('TERMCMD', os.environ.get('TERM'))
+			if term not in get_executables():
+				term = 'x-terminal-emulator'
 			if term not in get_executables():
 				term = 'xterm'
 			if isinstance(action, str):
diff --git a/ranger/defaults/commands.py b/ranger/defaults/commands.py
index da0c6735..ba9030c5 100644
--- a/ranger/defaults/commands.py
+++ b/ranger/defaults/commands.py
@@ -459,6 +459,11 @@ class terminal(Command):
 	Spawns an "x-terminal-emulator" starting in the current directory.
 	"""
 	def execute(self):
+		command = os.environ.get('TERMCMD', os.environ.get('TERM'))
+		if command not in get_executables():
+			command = 'x-terminal-emulator'
+		if command not in get_executables():
+			command = 'xterm'
 		self.fm.run('x-terminal-emulator', flags='d')