diff options
author | toonn <toonn@toonn.io> | 2018-01-30 15:05:43 +0100 |
---|---|---|
committer | toonn <toonn@toonn.io> | 2018-01-30 15:05:43 +0100 |
commit | a5767f170319c0b7043c4e09c9e35331f15dcd29 (patch) | |
tree | a94af2febd716012c4892e8044c7cd8b1a7e2a4d /ranger | |
parent | 14adeb9cfc1d95bda6895883fe70a50a08165589 (diff) | |
download | ranger-a5767f170319c0b7043c4e09c9e35331f15dcd29.tar.gz |
Guard tmux title changes
Changing the tmux window title to "ranger" was not guarded for the presence of the tmux executable, this tripped up at least one user with an `rc.conf` that still `set update_tmux_title true`. While the behavior is *not-a-bug*, I expect most people'd rather have the setting enabled by default since "python" is a less useful window title. Fix #1042
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/config/rc.conf | 2 | ||||
-rw-r--r-- | ranger/gui/ui.py | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/ranger/config/rc.conf b/ranger/config/rc.conf index 38e6f11e..39240b06 100644 --- a/ranger/config/rc.conf +++ b/ranger/config/rc.conf @@ -144,7 +144,7 @@ set display_tags_in_all_columns true set update_title false # Set the title to "ranger" in the tmux program? -set update_tmux_title false +set update_tmux_title true # Shorten the title if it gets long? The number defines how many # directories are displayed at once, 0 turns off this feature. diff --git a/ranger/gui/ui.py b/ranger/gui/ui.py index 990db0ad..4446cb29 100644 --- a/ranger/gui/ui.py +++ b/ranger/gui/ui.py @@ -9,6 +9,7 @@ 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 @@ -113,7 +114,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: + if self.settings.update_tmux_title and 'tmux' in get_executables(): try: self._tmux_automatic_rename = check_output( ['tmux', 'show-window-options', '-v', 'automatic-rename']).strip() @@ -123,7 +124,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: + if self.settings.update_tmux_title and 'tmux' in get_executables(): sys.stdout.write("\033kranger\033\\") sys.stdout.flush() @@ -172,7 +173,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: + if self.settings.update_tmux_title and 'tmux' in get_executables(): if self._tmux_automatic_rename: try: check_output(['tmux', 'set-window-option', |