mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-05 17:00:58 +01:00
include the command being run in the title
This commit is contained in:
parent
6e98119c46
commit
0a46ebf54f
3 changed files with 14 additions and 2 deletions
|
@ -203,6 +203,7 @@ class BaseShell(object):
|
|||
os.system('title {}'.format(t))
|
||||
else:
|
||||
sys.stdout.write("\x1b]2;{0}\x07".format(t))
|
||||
sys.stdout.flush()
|
||||
|
||||
@property
|
||||
def prompt(self):
|
||||
|
|
|
@ -613,6 +613,7 @@ def run_subproc(cmds, captured=True):
|
|||
'obj': prev_proc,
|
||||
'bg': background
|
||||
})
|
||||
builtins.__xonsh_shell__.settitle()
|
||||
if background:
|
||||
return
|
||||
if prev_is_proxy:
|
||||
|
|
|
@ -98,8 +98,8 @@ else:
|
|||
DEFAULT_PROMPT = ('{BOLD_GREEN}{user}@{hostname}{BOLD_BLUE} '
|
||||
'{cwd}{branch_color}{curr_branch} '
|
||||
'{BOLD_BLUE}{prompt_end}{NO_COLOR} ')
|
||||
|
||||
DEFAULT_TITLE = '{user}@{hostname}: {cwd} | xonsh'
|
||||
|
||||
DEFAULT_TITLE = '{current_job}{user}@{hostname}: {cwd} | xonsh'
|
||||
|
||||
@default_value
|
||||
def xonsh_data_dir(env):
|
||||
|
@ -564,6 +564,15 @@ def _collapsed_pwd():
|
|||
return leader + sep.join(base)
|
||||
|
||||
|
||||
def _current_job():
|
||||
j = builtins.__xonsh_active_job__
|
||||
if j is not None:
|
||||
j = builtins.__xonsh_all_jobs__[j]
|
||||
if not j['bg']:
|
||||
return '{} | '.format(j['cmds'][-1][0])
|
||||
return ''
|
||||
|
||||
|
||||
if ON_WINDOWS:
|
||||
USER = 'USERNAME'
|
||||
else:
|
||||
|
@ -580,6 +589,7 @@ FORMATTER_DICT = dict(
|
|||
short_cwd=_collapsed_pwd,
|
||||
curr_branch=current_branch,
|
||||
branch_color=branch_color,
|
||||
current_job=_current_job,
|
||||
**TERM_COLORS)
|
||||
DEFAULT_VALUES['FORMATTER_DICT'] = dict(FORMATTER_DICT)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue