summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-02-13 00:54:27 +0100
committerhut <hut@lavabit.com>2010-02-13 00:54:32 +0100
commit87db0130f83b071845258a073c62460ccdf6efe5 (patch)
tree7a28bc06041b84ae09516e456c37ed6d21ebaff6 /ranger
parent336cc468e37cb41ce9c1838c7d93138cf48e0916 (diff)
downloadranger-87db0130f83b071845258a073c62460ccdf6efe5.tar.gz
fixed #46: wrong username displayed when using su
Diffstat (limited to 'ranger')
-rw-r--r--ranger/gui/widgets/titlebar.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/ranger/gui/widgets/titlebar.py b/ranger/gui/widgets/titlebar.py
index 43729947..7c164ae9 100644
--- a/ranger/gui/widgets/titlebar.py
+++ b/ranger/gui/widgets/titlebar.py
@@ -53,9 +53,12 @@ class TitleBar(Widget):
 		self.result = bar.combine()
 
 	def _get_left_part(self, bar):
-		import socket, os
+		import socket, os, pwd
 
-		username = os.getenv('USER')
+		try:
+			username = pwd.getpwuid(os.geteuid()).pw_name
+		except:
+			username = "???"
 		if username == 'root':
 			clr = 'bad'
 		else: