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 | |
parent | 2a0af8e87cb9f2bda2857154f33ceee019bf3f9c (diff) | |
download | ranger-b72003856204a4101e9e123bc149ed248b13a382.tar.gz |
Add setting `hostname_in_titlebar`
Fixes #782
-rw-r--r-- | doc/ranger.1 | 5 | ||||
-rw-r--r-- | doc/ranger.pod | 4 | ||||
-rw-r--r-- | doc/rifle.1 | 2 | ||||
-rw-r--r-- | examples/rc_emacs.conf | 3 | ||||
-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 |
7 files changed, 26 insertions, 11 deletions
diff --git a/doc/ranger.1 b/doc/ranger.1 index a26043ce..abe6f70b 100644 --- a/doc/ranger.1 +++ b/doc/ranger.1 @@ -129,7 +129,7 @@ .\" ======================================================================== .\" .IX Title "RANGER 1" -.TH RANGER 1 "ranger-1.8.1" "2017-01-24" "ranger manual" +.TH RANGER 1 "ranger-1.8.1" "2017-01-29" "ranger manual" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -842,6 +842,9 @@ combination, e.g. \*(L"oN\*(R" to sort from Z to A. .IP "status_bar_on_top [bool]" 4 .IX Item "status_bar_on_top [bool]" Put the status bar at the top of the window? +.IP "hostname_in_titlebar [bool]" 4 +.IX Item "hostname_in_titlebar [bool]" +Show hostname in titlebar? .IP "tilde_in_titlebar [bool]" 4 .IX Item "tilde_in_titlebar [bool]" Abbreviate \f(CW$HOME\fR with ~ in the title bar (first line) of ranger? diff --git a/doc/ranger.pod b/doc/ranger.pod index e7f7acdc..ba80e5e7 100644 --- a/doc/ranger.pod +++ b/doc/ranger.pod @@ -850,6 +850,10 @@ combination, e.g. "oN" to sort from Z to A. Put the status bar at the top of the window? +=item hostname_in_titlebar [bool] + +Show hostname in titlebar? + =item tilde_in_titlebar [bool] Abbreviate $HOME with ~ in the title bar (first line) of ranger? diff --git a/doc/rifle.1 b/doc/rifle.1 index 66d5627f..cc062f02 100644 --- a/doc/rifle.1 +++ b/doc/rifle.1 @@ -129,7 +129,7 @@ .\" ======================================================================== .\" .IX Title "RIFLE 1" -.TH RIFLE 1 "rifle-1.8.1" "2017-01-24" "rifle manual" +.TH RIFLE 1 "rifle-1.8.1" "2017-01-29" "rifle manual" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/examples/rc_emacs.conf b/examples/rc_emacs.conf index 694496c2..5fd32ee2 100644 --- a/examples/rc_emacs.conf +++ b/examples/rc_emacs.conf @@ -135,6 +135,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/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 \ |