Search code examples
configurationenvironment-variablestmux

Shell variable is not being seen/used in Tmux configuration


I'm trying to use a shell variable in Tmux to configure some settings for the venerable powerline. The line of interest in my .tmux.config is:

run-shell "powerline-daemon -q"
source-file $POWERLINE_ROOT/powerline/bindings/tmux/powerline.conf

I get the following error :

/Users/myname/.tmux.conf:47: /powerline/bindings/tmux/powerline.conf: No such file or directory

It seems that the value of the environment variable $POWERLINE_ROOT is not being seen by Tmux. (I can confirm that $POWERLINE_ROOT does have a non-empty value.)

You can see my complete Tmux configuration if needed


Solution

  • Here's all I know:

    I have the following in my .bashrc:

    export __tmux_bg_inactive='234'
    export __tmux_bg_active='233'
    export __tmux_fg_inactive='245'
    export __tmux_fg_active='248'
    

    I have the following in my .tmux.conf:

    set -g window-style "fg=colour${__tmux_fg_inactive},bg=colour${__tmux_bg_inactive}" 
    set -g window-active-style "fg=colour${__tmux_fg_active},bg=colour${__tmux_bg_active}" 
    set -g pane-active-border-style "fg=colour$__green, bg=colour$__tmux_bg_active"
    set -g pane-border-style "fg=colour$__tmux_fg_inactive, bg=colour$__tmux_bg_inactive"
    
    

    This works for me. Maybe the fact that I've export'd the variable is what did it, or maybe it's that it's in my .bashrc so it gets set everywhere tmux could possibly need it?

    Let me know if that doesn't work.