summary refs log tree commit diff stats
path: root/ranger/gui
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-01-19 16:59:37 +0100
committerhut <hut@lavabit.com>2010-01-19 17:01:38 +0100
commit0268e3c3ff6b2235d0ca072c396b2b94ee13710b (patch)
treefe70b1eea6bea0164551da460807ade981f6ad06 /ranger/gui
parentffd5e26b420a1f9a0020314cd617459bb1da1898 (diff)
downloadranger-0268e3c3ff6b2235d0ca072c396b2b94ee13710b.tar.gz
titlebar: red hostname if logged in with root
Diffstat (limited to 'ranger/gui')
-rw-r--r--ranger/gui/widgets/titlebar.py12
1 files changed, 9 insertions, 3 deletions
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: