jlconlin
jlconlin

Reputation: 15084

Can't run powerline-config during startup (in .tmux.conf)

When I start tmux, I get a failure when trying to configure powerline. I have set an environment environment variable with this:

export POWERLINE_CONFIG_COMMAND=`which powerline-config`

My ~/.tmux.conf contains the following:

if-shell "POWERLINE_CONFIG_COMMAND" \
  run-shell "$POWERLINE_CONFIG_COMMAND tmux setup"

The error I get is:

unknown command: /path/to/powerline-config

I can run the config command manually after tmux starts with this:

$POWERLINE_CONFIG_COMMAND tmux setup

I don't understand why tmux can't run the command during the startup when it can run just fine afterwards.

Upvotes: 0

Views: 1324

Answers (1)

jeremysprofile
jeremysprofile

Reputation: 11504

I don't understand how you get that error. You should not get any message, and nothing should work.

if-shell "POWERLINE_CONFIG_COMMAND" \
  run-shell "$POWERLINE_CONFIG_COMMAND tmux setup"

will fail, because POWERLINE_CONFIG_COMMAND is not a command. Your if-shell should have a $ in front of POWERLINE_CONFIG_COMMAND.

Let's assume that was a typo, and it's correct in your actual .conf. Then, the problem is that run-shell runs against tmux, the way it'd run if you typed <prefix>: in your tmux session.

tmux $POWERLINE_CONFIG_COMMAND tmux setup is not a valid command.

You could instead do

   run-shell 'send-keys "$POWERLINE_CONFIG_COMMAND tmux setup" Enter'

If you wanted it run in a single pane.

Upvotes: 1

Related Questions