render.py:
bind command line editor to ^E add mouse support to editor add wt-prefix64 add command line history completion dotfiles: fix getlogin bug in some terminals
This commit is contained in:
parent
850d43bf28
commit
5704fafe4d
2 changed files with 19 additions and 4 deletions
|
@ -3,6 +3,7 @@
|
|||
|
||||
import datetime
|
||||
import os
|
||||
import pwd
|
||||
import socket
|
||||
import subprocess
|
||||
import sys
|
||||
|
@ -45,6 +46,12 @@ MOUNT_IGNORE_DIR = ["/dev", "/proc", "/sys"]
|
|||
|
||||
GIT_BLACKLIST = ["/var/paludis/repositories"]
|
||||
|
||||
def get_username():
|
||||
try:
|
||||
return os.getlogin()
|
||||
except FileNotFoundError:
|
||||
return pwd.getpwuid(os.geteuid())[0]
|
||||
|
||||
def style_color(fg):
|
||||
return "\033[38;5;%dm" %(fg)
|
||||
|
||||
|
@ -179,7 +186,7 @@ class LoginPart(Part):
|
|||
self.fragments.append(style_color(COLOR_USER_USER))
|
||||
|
||||
self.fragments.append(style_bold())
|
||||
user = os.getlogin()
|
||||
user = get_username()
|
||||
self.fragments.append(user)
|
||||
self.fragments.append(style_reset())
|
||||
|
||||
|
@ -276,7 +283,7 @@ class PathPart(Part):
|
|||
if path in homes:
|
||||
self.dirs = []
|
||||
|
||||
if homes[path] == os.getlogin():
|
||||
if homes[path] == get_username():
|
||||
self.dirs.append(Dir(path, "", "~"))
|
||||
else:
|
||||
self.dirs.append(Dir(path, homes[path], "~"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue