mirror of
https://github.com/b-ryan/powerline-shell.git
synced 2026-09-10 07:26:28 -04:00
Update for use custom indicators on root segment
This commit is contained in:
parent
c5272ced26
commit
50f1c01aa6
|
|
@ -4,11 +4,22 @@ from ..utils import BasicSegment
|
|||
class Segment(BasicSegment):
|
||||
def add_to_powerline(self):
|
||||
powerline = self.powerline
|
||||
config = self.powerline.config
|
||||
|
||||
def exists(obj, chain):
|
||||
_key = chain.pop(0)
|
||||
if _key in obj:
|
||||
return exists(obj[_key], chain) if chain else obj[_key]
|
||||
|
||||
def indicators(default, shell, path='root.indicators'):
|
||||
indicator = exists(config, (path + '.' + shell).split('.'))
|
||||
return indicator if indicator else default
|
||||
|
||||
root_indicators = {
|
||||
'bash': ' \\$ ',
|
||||
'tcsh': ' %# ',
|
||||
'zsh': ' %# ',
|
||||
'bare': ' $ ',
|
||||
'bash': indicators(' \\$ ', 'bash'),
|
||||
'tcsh': indicators(' %# ', 'tcsh'),
|
||||
'zsh': indicators(' %# ', 'zsh'),
|
||||
'bare': indicators(' $ ', 'bare'),
|
||||
}
|
||||
bg = powerline.theme.CMD_PASSED_BG
|
||||
fg = powerline.theme.CMD_PASSED_FG
|
||||
|
|
|
|||
Loading…
Reference in a new issue