This commit is contained in:
Kajigga 2022-09-27 18:57:19 +09:00 committed by GitHub
commit 9a59f7ece7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -54,27 +54,30 @@ def get_valid_cwd():
return cwd return cwd
class Powerline(object): DEFAULT_SYMBOLS = {
symbols = { 'compatible': {
'compatible': { 'lock': 'RO',
'lock': 'RO', 'network': 'SSH',
'network': 'SSH', 'separator': u'\u25B6',
'separator': u'\u25B6', 'separator_thin': u'\u276F'
'separator_thin': u'\u276F' },
}, 'patched': {
'patched': {
'lock': u'\uE0A2', 'lock': u'\uE0A2',
'network': 'SSH', 'network': 'SSH',
'separator': u'\uE0B0', 'separator': u'\uE0B0',
'separator_thin': u'\uE0B1' 'separator_thin': u'\uE0B1'
}, },
'flat': { 'flat': {
'lock': u'\uE0A2', 'lock': u'\uE0A2',
'network': 'SSH', 'network': 'SSH',
'separator': '', 'separator': '',
'separator_thin': '' 'separator_thin': ''
},
} }
}
class Powerline(object):
color_templates = { color_templates = {
'bash': r'\[\e%s\]', 'bash': r'\[\e%s\]',
@ -89,12 +92,16 @@ class Powerline(object):
self.theme = theme self.theme = theme
self.cwd = get_valid_cwd() self.cwd = get_valid_cwd()
mode = config.get("mode", "patched") mode = config.get("mode", "patched")
template_symbols = getattr(theme, 'SYMBOLS', DEFAULT_SYMBOLS)
symbols = template_symbols.get(mode, DEFAULT_SYMBOLS.get(mode, DEFAULT_SYMBOLS['patched']))
self.color_template = self.color_templates[args.shell] self.color_template = self.color_templates[args.shell]
self.reset = self.color_template % '[0m' self.reset = self.color_template % '[0m'
self.lock = Powerline.symbols[mode]['lock'] self.lock = symbols['lock']
self.network = Powerline.symbols[mode]['network'] self.network = symbols['network']
self.separator = Powerline.symbols[mode]['separator'] self.separator = symbols['separator']
self.separator_thin = Powerline.symbols[mode]['separator_thin'] self.separator_thin = symbols['separator_thin']
self.segments = [] self.segments = []
def segment_conf(self, seg_name, key, default=None): def segment_conf(self, seg_name, key, default=None):