I recently started using Ranger as my default file manager, and I'm really enjoying it. Right now, I've managed to change rifle.conf so that when I play audio or video from Ranger, mpv opens in a new xterm window and the media starts to play.
However, if possible, I would like Ranger to open the gnome-terminal instead of xterm. In /.config/ranger/rifle.conf
, it says that using the t
flag will run the program in a new terminal:
If $TERMCMD is not defined, rifle will attempt to extract it from $TERM
I tried setting $TERMCMD
in both my .profile and .bashrc files, but even though echo $TERMCMD
would print "gnome-terminal", Ranger would still open xterm. I also messed with setting $TERM
to "gnome-terminal", but that was messy and I decided to leave it alone.
Any suggestions? Thanks!
Best Answer
As of 2017, the source-code (runner.py) did this:
so you should be able to put any xterm-compatible program name in
TERMCMD
. However, note the use of-e
(gnome-terminal doesn't match xterm's behavior). If you are using Debian/Ubuntu/etc, the Debian packagers have attempted to provide a wrapper to hide this difference in thex-terminal-emulator
feature. If that applies to you, you could setTERMCMD
tox-terminal-emulator
.Followup - while the design of the
TERMCMD
feature has not changed appreciably since mid-2016, the location within the source has changed:That is implemented in
get_term
:which uses
x-terminal-emulator
as before.There is a related use of
TERMCMD
inrifle.py
, used for executing commands rather than (as asked in the question) for opening a terminal. Either way, the key to using ranger isx-terminal-emulator
, since GNOME Terminal's developers do not document their command-line interface, while Debian developers have provided this workaround.Quoting from Bug 701691 – -e accepts only one term; all other terminal emulators accept more than one term (which the developer refused to fix, marking it "not a bug"):