mirror of
https://github.com/b-ryan/powerline-shell.git
synced 2026-09-10 07:26:28 -04:00
Adding an SSH segment
This commit is contained in:
parent
60cf330b8c
commit
837ad970fa
|
|
@ -16,6 +16,9 @@ SEGMENTS = [
|
|||
# Show the machine's hostname. Mostly used when ssh-ing into other machines
|
||||
'hostname',
|
||||
|
||||
# Show a padlock when ssh-ing from another machine
|
||||
'ssh',
|
||||
|
||||
# Show the current directory. If the path is too long, the middle part is
|
||||
# replaced with ellipsis ('...')
|
||||
'cwd',
|
||||
|
|
|
|||
|
|
@ -12,16 +12,19 @@ class Powerline:
|
|||
symbols = {
|
||||
'compatible': {
|
||||
'lock': 'RO',
|
||||
'network': 'SSH',
|
||||
'separator': u'\u25B6',
|
||||
'separator_thin': u'\u276F'
|
||||
},
|
||||
'patched': {
|
||||
'lock': u'\uE0A2',
|
||||
'network': u'\uE0A2',
|
||||
'separator': u'\uE0B0',
|
||||
'separator_thin': u'\uE0B1'
|
||||
},
|
||||
'flat': {
|
||||
'lock': '',
|
||||
'network': '',
|
||||
'separator': '',
|
||||
'separator_thin': ''
|
||||
},
|
||||
|
|
@ -40,6 +43,7 @@ class Powerline:
|
|||
self.color_template = self.color_templates[shell]
|
||||
self.reset = self.color_template % '[0m'
|
||||
self.lock = Powerline.symbols[mode]['lock']
|
||||
self.network = Powerline.symbols[mode]['network']
|
||||
self.separator = Powerline.symbols[mode]['separator']
|
||||
self.separator_thin = Powerline.symbols[mode]['separator_thin']
|
||||
self.segments = []
|
||||
|
|
|
|||
8
segments/ssh.py
Normal file
8
segments/ssh.py
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
import os
|
||||
|
||||
def add_ssh_segment():
|
||||
|
||||
if os.getenv('SSH_CLIENT'):
|
||||
powerline.append(' %s ' % powerline.network, Color.SSH_FG, Color.SSH_BG)
|
||||
|
||||
add_ssh_segment()
|
||||
|
|
@ -20,6 +20,9 @@ class DefaultColor:
|
|||
READONLY_BG = 124
|
||||
READONLY_FG = 254
|
||||
|
||||
SSH_BG = 166 # medium orange
|
||||
SSH_FG = 254
|
||||
|
||||
REPO_CLEAN_BG = 148 # a light green color
|
||||
REPO_CLEAN_FG = 0 # black
|
||||
REPO_DIRTY_BG = 161 # pink/red
|
||||
|
|
|
|||
Loading…
Reference in a new issue