diff options
author | hut <hut@lavabit.com> | 2010-01-19 16:59:37 +0100 |
---|---|---|
committer | hut <hut@lavabit.com> | 2010-01-19 17:01:38 +0100 |
commit | 0268e3c3ff6b2235d0ca072c396b2b94ee13710b (patch) | |
tree | fe70b1eea6bea0164551da460807ade981f6ad06 /ranger | |
parent | ffd5e26b420a1f9a0020314cd617459bb1da1898 (diff) | |
download | ranger-0268e3c3ff6b2235d0ca072c396b2b94ee13710b.tar.gz |
titlebar: red hostname if logged in with root
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/colorschemes/default.py | 2 | ||||
-rw-r--r-- | ranger/gui/widgets/titlebar.py | 12 |
2 files changed, 10 insertions, 4 deletions
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: |