diff options
author | hut <hut@lavabit.com> | 2012-01-18 16:21:20 +0100 |
---|---|---|
committer | hut <hut@lavabit.com> | 2012-01-18 16:21:20 +0100 |
commit | c2b71f721ba4fec22e6b8135508e07cb56df3320 (patch) | |
tree | 1ec8c15bdfd7b82ec2b48fcb0fd345c24b0620f8 | |
parent | 1cc4c0e4c2a022d64dac2d380729ffacb2cfa31c (diff) | |
download | ranger-c2b71f721ba4fec22e6b8135508e07cb56df3320.tar.gz |
Added doc for TERMCMD and integrated it in commands.py
-rw-r--r-- | doc/ranger.pod | 7 | ||||
-rw-r--r-- | ranger/core/runner.py | 4 | ||||
-rw-r--r-- | ranger/defaults/commands.py | 5 |
3 files changed, 15 insertions, 1 deletions
diff --git a/doc/ranger.pod b/doc/ranger.pod index e261ca60..65615a8e 100644 --- a/doc/ranger.pod +++ b/doc/ranger.pod @@ -956,6 +956,13 @@ program out of "vim", "emacs" and "nano". Defines the shell that ranger is going to use with the :shell command and the "S" key. Defaults to "bash". +=item TERMCMD + +Defines the terminal emulator command that ranger is going to use with the +:terminal command and the "t" run flag. Defaults to "x-terminal-emulator" or +"xterm" + + =item XDG_CONFIG_HOME Specifies the directory for configuration files. Defaults to F<$HOME/.config>. 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') |