summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-03-19 16:08:24 +0100
committerhut <hut@lavabit.com>2010-03-19 16:08:24 +0100
commit2a3f4586899ce1b25c131e53903d646515076470 (patch)
treebfa86f216d69c0e73fbcff20bbebea21f334e8d6
parent3547d30049f40abcc6daa5626643446e5c9963cb (diff)
downloadranger-2a3f4586899ce1b25c131e53903d646515076470.tar.gz
widgets.titlebar: get the username/hostname from environment
-rw-r--r--ranger/gui/widgets/titlebar.py12
1 files changed, 3 insertions, 9 deletions
diff --git a/ranger/gui/widgets/titlebar.py b/ranger/gui/widgets/titlebar.py
index cb6e8cdd..e1be8e97 100644
--- a/ranger/gui/widgets/titlebar.py
+++ b/ranger/gui/widgets/titlebar.py
@@ -54,20 +54,14 @@ class TitleBar(Widget):
 		self.result = bar.combine()
 
 	def _get_left_part(self, bar):
-		import socket, os, pwd
-
-		try:
-			username = pwd.getpwuid(os.geteuid()).pw_name
-		except:
-			username = "???"
-		if username == 'root':
+		if self.env.username == 'root':
 			clr = 'bad'
 		else:
 			clr = 'good'
 
-		bar.add(username, 'hostname', clr, fixedsize=True)
+		bar.add(self.env.username, 'hostname', clr, fixedsize=True)
 		bar.add('@', 'hostname', clr, fixedsize=True)
-		bar.add(socket.gethostname(), 'hostname', clr, fixedsize=True)
+		bar.add(self.env.hostname, 'hostname', clr, fixedsize=True)
 
 		for path in self.env.pathway:
 			if path.islink: