diff options
-rw-r--r-- | TODO | 1 | ||||
-rw-r--r-- | ranger/colorschemes/default.py | 2 | ||||
-rw-r--r-- | ranger/gui/widgets/titlebar.py | 12 |
3 files changed, 11 insertions, 4 deletions
diff --git a/TODO b/TODO index ed420d3c..1f7be5e7 100644 --- a/TODO +++ b/TODO @@ -47,6 +47,7 @@ Bugs (X) #31 10/01/06 ^C breaks cd-after-exit by stopping sourced shell script ( ) #40 10/01/17 freeze with unavailable sshfs (X) #41 10/01/17 capital file extensions are not recognized + ( ) #46 10/01/19 old username displayed after using su Ideas diff --git a/ranger/colorschemes/default.py b/ranger/colorschemes/default.py index 68f1d4a7..1c7f1e1b 100644 --- a/ranger/colorschemes/default.py +++ b/ranger/colorschemes/default.py @@ -72,7 +72,7 @@ class Default(ColorScheme): attr |= bold if context.hostname: - fg = green + fg = context.bad and red or green elif context.directory: fg = blue diff --git a/ranger/gui/widgets/titlebar.py b/ranger/gui/widgets/titlebar.py index b702b3e7..7b557f3d 100644 --- a/ranger/gui/widgets/titlebar.py +++ b/ranger/gui/widgets/titlebar.py @@ -54,10 +54,16 @@ class TitleBar(Widget): def _get_left_part(self, bar): import socket, os + + username = os.getenv('USER') + if logname == 'root': + clr = 'bad' + else: + clr = 'good' - bar.add(os.getenv('LOGNAME'), 'hostname', fixedsize=True) - bar.add('@', 'hostname', fixedsize=True) - bar.add(socket.gethostname(), 'hostname', fixedsize=True) + bar.add(username, 'hostname', clr, fixedsize=True) + bar.add('@', 'hostname', clr, fixedsize=True) + bar.add(socket.gethostname(), 'hostname', clr, fixedsize=True) for path in self.env.pathway: if path.islink: |