Exemple #1
0
def source_tmux_files(pl,
                      args,
                      tmux_version=None,
                      source_tmux_file=source_tmux_file):
    '''Source relevant version-specific tmux configuration files

    Files are sourced in the following order:
    * First relevant files with older versions are sourced.
    * If files for same versions are to be sourced then first _minus files are
      sourced, then _plus files and then files without _minus or _plus suffixes.
    '''
    tmux_version = tmux_version or get_tmux_version(pl)
    source_tmux_file(os.path.join(TMUX_CONFIG_DIRECTORY,
                                  'powerline-base.conf'))
    for fname, priority in sorted(get_tmux_configs(tmux_version),
                                  key=(lambda v: v[1])):
        source_tmux_file(fname)
    if not os.environ.get('POWERLINE_COMMAND'):
        cmd = deduce_command()
        if cmd:
            set_tmux_environment('POWERLINE_COMMAND',
                                 deduce_command(),
                                 remove=False)
    try:
        run_tmux_command('refresh-client')
    except subprocess.CalledProcessError:
        # On tmux-2.0 this command may fail for whatever reason. Since it is
        # critical just ignore the failure.
        pass
Exemple #2
0
	def source_tmux_file_nosource(fname):
		with open(fname) as fd:
			for line in fd:
				if line.startswith('#') or line == '\n':
					continue
				args = shlex.split(line)
				args = [args[0]] + [replace_env(arg) for arg in args[1:]]
				run_tmux_command(*args)
Exemple #3
0
 def source_tmux_file_nosource(fname):
     with open(fname) as fd:
         for line in fd:
             if line.startswith('#') or line == '\n':
                 continue
             args = shlex.split(line)
             args = [args[0]] + [replace_env(arg) for arg in args[1:]]
             run_tmux_command(*args)
Exemple #4
0
def source_tmux_files(pl, args, tmux_version=None, source_tmux_file=source_tmux_file):
	'''Source relevant version-specific tmux configuration files

	Files are sourced in the following order:
	* First relevant files with older versions are sourced.
	* If files for same versions are to be sourced then first _minus files are 
	  sourced, then _plus files and then files without _minus or _plus suffixes.
	'''
	tmux_version = tmux_version or get_tmux_version(pl)
	source_tmux_file(os.path.join(TMUX_CONFIG_DIRECTORY, 'powerline-base.conf'))
	for fname, priority in sorted(get_tmux_configs(tmux_version), key=(lambda v: v[1])):
		source_tmux_file(fname)
	if not os.environ.get('POWERLINE_COMMAND'):
		cmd = deduce_command()
		if cmd:
			set_tmux_environment('POWERLINE_COMMAND', deduce_command(), remove=False)
	try:
		run_tmux_command('refresh-client')
	except subprocess.CalledProcessError:
		# On tmux-2.0 this command may fail for whatever reason. Since it is 
		# critical just ignore the failure.
		pass
Exemple #5
0
def source_tmux_files(pl, args):
	'''Source relevant version-specific tmux configuration files

	Files are sourced in the following order:
	* First relevant files with older versions are sourced.
	* If files for same versions are to be sourced then first _minus files are 
	  sourced, then _plus files and then files without _minus or _plus suffixes.
	'''
	version = get_tmux_version(pl)
	for fname, priority in sorted(get_tmux_configs(version), key=(lambda v: v[1])):
		run_tmux_command('source', fname)
	if not os.environ.get('POWERLINE_COMMAND'):
		cmd = deduce_command()
		if cmd:
			run_tmux_command('set-environment', '-g', 'POWERLINE_COMMAND', deduce_command())
	run_tmux_command('refresh-client')
Exemple #6
0
def source_tmux_files(pl, args):
	'''Source relevant version-specific tmux configuration files

	Files are sourced in the following order:
	* First relevant files with older versions are sourced.
	* If files for same versions are to be sourced then first _minus files are 
	  sourced, then _plus files and then files without _minus or _plus suffixes.
	'''
	version = get_tmux_version(pl)
	run_tmux_command('source', os.path.join(TMUX_CONFIG_DIRECTORY, 'powerline-base.conf'))
	for fname, priority in sorted(get_tmux_configs(version), key=(lambda v: v[1])):
		run_tmux_command('source', fname)
	if not os.environ.get('POWERLINE_COMMAND'):
		cmd = deduce_command()
		if cmd:
			set_tmux_environment('POWERLINE_COMMAND', deduce_command(), remove=False)
	run_tmux_command('refresh-client')