Also use the same code for tmux
This commit is contained in:
parent
05384e31e4
commit
8374a66ca7
|
@ -111,6 +111,10 @@ def source_tmux_files(pl, args):
|
|||
version = get_tmux_version(pl)
|
||||
for fname, priority in sorted(get_tmux_configs(version), key=(lambda v: v[1])):
|
||||
run_tmux_command('source', fname)
|
||||
cmd = deduce_command()
|
||||
if cmd:
|
||||
run_tmux_command('set-environment', '-g', 'POWERLINE_COMMAND', deduce_command())
|
||||
run_tmux_command('refresh-client')
|
||||
|
||||
|
||||
def create_powerline_logger(args):
|
||||
|
@ -124,11 +128,10 @@ def create_powerline_logger(args):
|
|||
|
||||
def check_command(cmd):
|
||||
if which(cmd):
|
||||
print(cmd)
|
||||
sys.exit(0)
|
||||
return cmd
|
||||
|
||||
|
||||
def shell_command(pl, args):
|
||||
def deduce_command():
|
||||
'''Deduce which command to use for ``powerline``
|
||||
|
||||
Candidates:
|
||||
|
@ -144,11 +147,21 @@ def shell_command(pl, args):
|
|||
* ``powerline-render``. Should not really ever be used.
|
||||
* ``{powerline_root}/scripts/powerline-render``. Same.
|
||||
'''
|
||||
check_command('powerline')
|
||||
check_command(os.path.join(POWERLINE_ROOT, 'scripts', 'powerline'))
|
||||
if which('sh') and which('sed') and which('socat'):
|
||||
check_command(os.path.join(POWERLINE_ROOT, 'client', 'powerline.sh'))
|
||||
check_command(os.path.join(POWERLINE_ROOT, 'client', 'powerline.py'))
|
||||
check_command('powerline-render')
|
||||
check_command(os.path.join(POWERLINE_ROOT, 'scripts', 'powerline-render'))
|
||||
sys.exit(1)
|
||||
return (
|
||||
None
|
||||
or check_command('powerline')
|
||||
or check_command(os.path.join(POWERLINE_ROOT, 'scripts', 'powerline'))
|
||||
or ((which('sh') and which('sed') and which('socat'))
|
||||
and check_command(os.path.join(POWERLINE_ROOT, 'client', 'powerline.sh')))
|
||||
or check_command(os.path.join(POWERLINE_ROOT, 'client', 'powerline.py'))
|
||||
or check_command('powerline-render')
|
||||
or check_command(os.path.join(POWERLINE_ROOT, 'scripts', 'powerline-render'))
|
||||
)
|
||||
|
||||
|
||||
def shell_command(pl, args):
|
||||
cmd = deduce_command()
|
||||
if cmd:
|
||||
print(cmd)
|
||||
else:
|
||||
sys.exit(1)
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
if-shell 'test -z "$POWERLINE_COMMAND"' 'if-shell "which powerline" "set-environment -g POWERLINE_COMMAND powerline" "set-environment -g POWERLINE_COMMAND powerline-render"'
|
||||
if-shell 'test -z "$POWERLINE_CONFIG_COMMAND"' 'set-environment -g POWERLINE_CONFIG_COMMAND powerline-config'
|
||||
|
||||
# Don't version-check for this core functionality -- anything too old to
|
||||
|
|
Loading…
Reference in New Issue