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:
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228