mirror of
https://github.com/b-ryan/powerline-shell.git
synced 2026-09-10 07:26:28 -04:00
23 lines
724 B
Python
23 lines
724 B
Python
import os
|
|
import socket
|
|
from ..utils import BasicSegment
|
|
|
|
|
|
class Segment(BasicSegment):
|
|
def add_to_powerline(self):
|
|
powerline = self.powerline
|
|
term = os.getenv('TERM')
|
|
if not (('xterm' in term) or ('rxvt' in term)):
|
|
return
|
|
if powerline.args.shell == 'bash':
|
|
set_title = '\\[\\e]0;\\u@\\h: \\w\\a\\]'
|
|
elif powerline.args.shell == 'zsh':
|
|
set_title = '%{\033]0;%n@%m: %~\007%}'
|
|
else:
|
|
set_title = '\033]0;%s@%s: %s\007' % (
|
|
os.getenv('USER'),
|
|
socket.gethostname().split('.')[0],
|
|
powerline.cwd or os.getenv('PWD'),
|
|
)
|
|
powerline.append(set_title, None, None, '')
|