aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortoonn <toonn@toonn.io>2018-01-31 23:30:51 +0100
committertoonn <toonn@toonn.io>2018-01-31 23:30:51 +0100
commitb8a2311bd72f39d2adf4bc0c365c3c22e0ec3897 (patch)
treef372cd302cbc4a6c5132d849deeb57c9543c0c32
parenta5767f170319c0b7043c4e09c9e35331f15dcd29 (diff)
downloadranger-b8a2311bd72f39d2adf4bc0c365c3c22e0ec3897.tar.gz
Only try changing the tmux title if inside tmux
Check whether we're running in `tmux` by checking the existence of `$TMUX` and only if so set the window title.
-rw-r--r--ranger/gui/ui.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/ranger/gui/ui.py b/ranger/gui/ui.py
index 4446cb29..4f76dfab 100644
--- a/ranger/gui/ui.py
+++ b/ranger/gui/ui.py
@@ -9,7 +9,6 @@ import threading
import curses
from subprocess import CalledProcessError
-from ranger.ext.get_executables import get_executables
from ranger.ext.keybinding_parser import KeyBuffer, KeyMaps, ALT_KEY
from ranger.ext.lazy_property import lazy_property
from ranger.ext.signals import Signal
@@ -114,7 +113,7 @@ class UI( # pylint: disable=too-many-instance-attributes,too-many-public-method
self._draw_title = curses.tigetflag('hs') # has_status_line
# Save tmux setting `automatic-rename`
- if self.settings.update_tmux_title and 'tmux' in get_executables():
+ if self.settings.update_tmux_title and 'TMUX' in os.environ:
try:
self._tmux_automatic_rename = check_output(
['tmux', 'show-window-options', '-v', 'automatic-rename']).strip()
@@ -124,7 +123,7 @@ class UI( # pylint: disable=too-many-instance-attributes,too-many-public-method
self.update_size()
self.is_on = True
- if self.settings.update_tmux_title and 'tmux' in get_executables():
+ if self.settings.update_tmux_title and 'TMUX' in os.environ:
sys.stdout.write("\033kranger\033\\")
sys.stdout.flush()
@@ -173,7 +172,7 @@ class UI( # pylint: disable=too-many-instance-attributes,too-many-public-method
DisplayableContainer.destroy(self)
# Restore tmux setting `automatic-rename`
- if self.settings.update_tmux_title and 'tmux' in get_executables():
+ if self.settings.update_tmux_title and 'TMUX' in os.environ:
if self._tmux_automatic_rename:
try:
check_output(['tmux', 'set-window-option',