dotfiles/config/powerline-shell/segments/root.py

19 lines
591 B
Python
Raw Normal View History

2021-04-20 11:12:35 +00:00
from ..utils import BasicSegment
class Segment(BasicSegment):
def add_to_powerline(self):
powerline = self.powerline
root_indicators = {
'bash': ' \\$ ',
'tcsh': ' %# ',
'zsh': ' %# ',
'bare': ' $ ',
}
bg = powerline.theme.CMD_PASSED_BG
fg = powerline.theme.CMD_PASSED_FG
if powerline.args.prev_error != 0:
fg = powerline.theme.CMD_FAILED_FG
bg = powerline.theme.CMD_FAILED_BG
powerline.append(root_indicators[powerline.args.shell], fg, bg, sanitize=False)