Join setenv and source actions into one

It appears that tmux-1.6 is not able to function properly. Most likely this is
because prior to some tmux version running shell commands in background is the
default and only option and starting from some version `run-shell` does not run
processes in background *by default*.

This means that `source` action is run while `setenv` action is running and
since `source` needs to load a bunch of configuration files, *including*
importing a bunch of modules when creating renderer `source` and corresponding
tmux actions are finished earlier.

It is only a guess though: I am not even seeing race condition: `source` *is*
run, `setenv` also *is*, but `source` is *always* before `setenv`.
This commit is contained in:
ZyX 2015-01-16 22:34:44 +03:00
parent 70b1e342c4
commit b23daa251c
3 changed files with 7 additions and 6 deletions

View File

@ -164,6 +164,11 @@ def init_tmux_environment(pl, args):
' ' * powerline.renderer.strwidth(left_dividers['hard']))) ' ' * powerline.renderer.strwidth(left_dividers['hard'])))
def tmux_setup(pl, args):
init_tmux_environment(pl, args)
source_tmux_files(pl, args)
def get_main_config(args): def get_main_config(args):
find_config_files = generate_config_finder() find_config_files = generate_config_finder()
config_loader = ConfigLoader(run_once=True) config_loader = ConfigLoader(run_once=True)

View File

@ -1,9 +1,4 @@
if-shell 'test -z "$POWERLINE_CONFIG_COMMAND"' 'set-environment -g POWERLINE_CONFIG_COMMAND powerline-config' if-shell 'test -z "$POWERLINE_CONFIG_COMMAND"' 'set-environment -g POWERLINE_CONFIG_COMMAND powerline-config'
run-shell 'eval $POWERLINE_CONFIG_COMMAND tmux setenv' run-shell 'eval $POWERLINE_CONFIG_COMMAND tmux setup'
# Simplify tmux version checking by using multiple config files. Source these
# config files based on the version in which tmux features were added and/or
# deprecated. By splitting these configuration options into separate files,
run-shell 'eval $POWERLINE_CONFIG_COMMAND tmux source'
# vim: ft=tmux # vim: ft=tmux

View File

@ -21,6 +21,7 @@ class StrFunction(object):
TMUX_ACTIONS = { TMUX_ACTIONS = {
'source': StrFunction(config.source_tmux_files, 'source'), 'source': StrFunction(config.source_tmux_files, 'source'),
'setenv': StrFunction(config.init_tmux_environment, 'setenv'), 'setenv': StrFunction(config.init_tmux_environment, 'setenv'),
'setup': StrFunction(config.tmux_setup, 'setup'),
} }