diff options
-rw-r--r-- | ranger/defaults/options.py | 3 | ||||
-rw-r--r-- | ranger/gui/widgets/titlebar.py | 15 | ||||
-rw-r--r-- | ranger/shared/settings.py | 1 |
3 files changed, 16 insertions, 3 deletions
diff --git a/ranger/defaults/options.py b/ranger/defaults/options.py index 2de8a230..9fb9d728 100644 --- a/ranger/defaults/options.py +++ b/ranger/defaults/options.py @@ -60,6 +60,9 @@ save_console_history = True draw_borders = False draw_bookmark_borders = True +# Display the directory name in tabs? +dirname_in_tabs = False + # How many columns are there, and what are their relative widths? column_ratios = (1, 1, 4, 3) diff --git a/ranger/gui/widgets/titlebar.py b/ranger/gui/widgets/titlebar.py index a949df05..b569a26f 100644 --- a/ranger/gui/widgets/titlebar.py +++ b/ranger/gui/widgets/titlebar.py @@ -19,6 +19,7 @@ The titlebar is the widget at the top, giving you broad orientation. It displays the current path among other things. """ +from os.path import basename from math import floor from . import Widget @@ -68,7 +69,8 @@ class TitleBar(Widget): pos = self.wid - 1 for tabname in reversed(self.fm._get_tab_list()): - pos -= len(str(tabname)) + 1 + tabtext = self._get_tab_text(tabname) + pos -= len(tabtext) if event.x > pos: self.fm.tab_open(tabname) self.need_redraw = True @@ -137,9 +139,16 @@ class TitleBar(Widget): self.tab_width = 0 if len(self.fm.tabs) > 1: for tabname in self.fm._get_tab_list(): - self.tab_width += len(str(tabname)) + 1 + tabtext = self._get_tab_text(tabname) + self.tab_width += len(tabtext) clr = 'good' if tabname == self.fm.current_tab else 'bad' - bar.addright(' '+str(tabname), 'tab', clr, fixed=True) + bar.addright(tabtext, 'tab', clr, fixed=True) + + def _get_tab_text(self, tabname): + if self.settings.dirname_in_tabs: + return ' ' + str(tabname) + ":" + basename(self.fm.tabs[tabname]) + else: + return ' ' + str(tabname) def _print_result(self, result): import _curses diff --git a/ranger/shared/settings.py b/ranger/shared/settings.py index 910f20bf..1822c38a 100644 --- a/ranger/shared/settings.py +++ b/ranger/shared/settings.py @@ -30,6 +30,7 @@ ALLOWED_SETTINGS = { 'display_size_in_status_bar': bool, 'draw_borders': bool, 'draw_bookmark_borders': bool, + 'dirname_in_tabs': bool, 'sort': str, 'sort_reverse': bool, 'sort_case_insensitive': bool, |