diff options
author | nfnty <git@nfnty.se> | 2017-01-29 18:10:44 +0100 |
---|---|---|
committer | nfnty <git@nfnty.se> | 2017-01-29 18:16:47 +0100 |
commit | b72003856204a4101e9e123bc149ed248b13a382 (patch) | |
tree | 1b8814dc7cc1336ae332acafec23e26f3c357fb5 /ranger | |
parent | 2a0af8e87cb9f2bda2857154f33ceee019bf3f9c (diff) | |
download | ranger-b72003856204a4101e9e123bc149ed248b13a382.tar.gz |
Add setting `hostname_in_titlebar`
Fixes #782
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/config/rc.conf | 3 | ||||
-rw-r--r-- | ranger/container/settings.py | 1 | ||||
-rw-r--r-- | ranger/gui/widgets/titlebar.py | 19 |
3 files changed, 14 insertions, 9 deletions
diff --git a/ranger/config/rc.conf b/ranger/config/rc.conf index 19ed2a6a..5de0b18f 100644 --- a/ranger/config/rc.conf +++ b/ranger/config/rc.conf @@ -141,6 +141,9 @@ set update_tmux_title false # directories are displayed at once, 0 turns off this feature. set shorten_title 3 +# Show hostname in titlebar? +set hostname_in_titlebar true + # Abbreviate $HOME with ~ in the titlebar (first line) of ranger? set tilde_in_titlebar false diff --git a/ranger/container/settings.py b/ranger/container/settings.py index f4679453..e08f18c6 100644 --- a/ranger/container/settings.py +++ b/ranger/container/settings.py @@ -66,6 +66,7 @@ ALLOWED_SETTINGS = { 'sort_unicode': bool, 'sort': str, 'status_bar_on_top': bool, + 'hostname_in_titlebar': bool, 'tilde_in_titlebar': bool, 'unicode_ellipsis': bool, 'update_title': bool, diff --git a/ranger/gui/widgets/titlebar.py b/ranger/gui/widgets/titlebar.py index a2c54516..d4ca904c 100644 --- a/ranger/gui/widgets/titlebar.py +++ b/ranger/gui/widgets/titlebar.py @@ -90,15 +90,16 @@ class TitleBar(Widget): def _get_left_part(self, bar): # TODO: Properly escape non-printable chars without breaking unicode - if self.fm.username == 'root': - clr = 'bad' - else: - clr = 'good' - - bar.add(self.fm.username, 'hostname', clr, fixed=True) - bar.add('@', 'hostname', clr, fixed=True) - bar.add(self.fm.hostname, 'hostname', clr, fixed=True) - bar.add(' ', 'hostname', clr, fixed=True) + if self.settings.hostname_in_titlebar: + if self.fm.username == 'root': + clr = 'bad' + else: + clr = 'good' + + bar.add(self.fm.username, 'hostname', clr, fixed=True) + bar.add('@', 'hostname', clr, fixed=True) + bar.add(self.fm.hostname, 'hostname', clr, fixed=True) + bar.add(' ', 'hostname', clr, fixed=True) pathway = self.fm.thistab.pathway if self.settings.tilde_in_titlebar and \ |