summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--doc/ranger.13
-rw-r--r--doc/ranger.pod4
-rw-r--r--examples/rc_emacs.conf3
-rw-r--r--ranger/config/rc.conf3
-rw-r--r--ranger/container/settings.py1
-rw-r--r--ranger/gui/ui.py26
6 files changed, 32 insertions, 8 deletions
diff --git a/doc/ranger.1 b/doc/ranger.1
index 5a29f6e1..2f233c95 100644
--- a/doc/ranger.1
+++ b/doc/ranger.1
@@ -1083,6 +1083,9 @@ Requires the python-bidi pip package.
 .IP "update_title [bool]" 4
 .IX Item "update_title [bool]"
 Set a window title?
+.IP "update_icon_title [bool]" 4
+.IX Item "update_icon_title [bool]"
+Set an icon title?
 .IP "update_tmux_title [bool]" 4
 .IX Item "update_tmux_title [bool]"
 Set the title to \*(L"ranger\*(R" in the tmux program?
diff --git a/doc/ranger.pod b/doc/ranger.pod
index fadd4cba..3b59c9e5 100644
--- a/doc/ranger.pod
+++ b/doc/ranger.pod
@@ -1124,6 +1124,10 @@ Requires the python-bidi pip package.
 
 Set a window title?
 
+=item update_icon_title [bool]
+
+Set an icon title?
+
 =item update_tmux_title [bool]
 
 Set the title to "ranger" in the tmux program?
diff --git a/examples/rc_emacs.conf b/examples/rc_emacs.conf
index 0462282e..ac3937bf 100644
--- a/examples/rc_emacs.conf
+++ b/examples/rc_emacs.conf
@@ -131,6 +131,9 @@ set display_tags_in_all_columns true
 # Set a title for the window?
 set update_title false
 
+# Set a title for the icon?
+set update_icon_title false
+
 # Set the title to "ranger" in the tmux program?
 set update_tmux_title true
 
diff --git a/ranger/config/rc.conf b/ranger/config/rc.conf
index f559290d..b4bb4bfc 100644
--- a/ranger/config/rc.conf
+++ b/ranger/config/rc.conf
@@ -179,6 +179,9 @@ set display_tags_in_all_columns true
 # Set a title for the window?
 set update_title false
 
+# Set a title for the icon?
+set update_icon_title false
+
 # Set the title to "ranger" in the tmux program?
 set update_tmux_title true
 
diff --git a/ranger/container/settings.py b/ranger/container/settings.py
index 478f6124..3075aadf 100644
--- a/ranger/container/settings.py
+++ b/ranger/container/settings.py
@@ -86,6 +86,7 @@ ALLOWED_SETTINGS = {
     'tilde_in_titlebar': bool,
     'unicode_ellipsis': bool,
     'update_title': bool,
+    'update_icon_title': bool,
     'update_tmux_title': bool,
     'use_preview_script': bool,
     'vcs_aware': bool,
diff --git a/ranger/gui/ui.py b/ranger/gui/ui.py
index 2874ee97..207061ce 100644
--- a/ranger/gui/ui.py
+++ b/ranger/gui/ui.py
@@ -368,7 +368,9 @@ class UI(  # pylint: disable=too-many-instance-attributes,too-many-public-method
         """Draw all objects in the container"""
         self.win.touchwin()
         DisplayableContainer.draw(self)
-        if self._draw_title and self.settings.update_title:
+        if self._draw_title \
+            and (self.settings.update_title
+                 or self.settings.update_icon_title):
             cwd = self.fm.thisdir.path
             if self.settings.tilde_in_titlebar \
                and (cwd == self.fm.home_path
@@ -381,16 +383,24 @@ class UI(  # pylint: disable=too-many-instance-attributes,too-many-public-method
             try:
                 fixed_cwd = cwd.encode('utf-8', 'surrogateescape'). \
                     decode('utf-8', 'replace')
-                fmt_tup = (
-                    curses.tigetstr('tsl').decode('latin-1'),
-                    fixed_cwd,
-                    curses.tigetstr('fsl').decode('latin-1'),
-                )
+                escapes = [
+                    (
+                        curses.tigetstr('tsl').decode('latin-1'),
+                        self.settings.update_title,
+                    ),
+                    (
+                        '\x1b]1;',
+                        self.settings.update_icon_title,
+                    ),
+                ]
+                bel = curses.tigetstr('fsl').decode('latin-1')
+                fmt_tups = [(e, fixed_cwd, bel) for e, s in escapes if s]
             except UnicodeError:
                 pass
             else:
-                sys.stdout.write("%sranger:%s%s" % fmt_tup)
-                sys.stdout.flush()
+                for fmt_tup in fmt_tups:
+                    sys.stdout.write("%sranger:%s%s" % fmt_tup)
+                    sys.stdout.flush()
 
         self.win.refresh()