dasilvacontin / contrib-rocket

:rocket::new_moon: Contrib-fueled rocket for motivation!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tmux status-bar can't use sourced scripts, only commands/bins

dasilvacontin opened this issue · comments

Works now, maybe it was fixed in a newer version of tmux (?). I'll try finding out in which version it was fixed... someday...

My bad, I was using (gh-contribs -d 7 | spark) on my tmux status bar since contrib-rocket didn't work.

contrib-rocket is never being defined because...

The tmux man page states for the set option:

#(shell-command) First line of the command's output

But I'm pretty sure, that does not mean shell funcitons, because tmux will not execute the shell-command in the current shell-session, but start a new instance, which starts as non-interactive, hence does not source your ~/.zshrc config and so does not know about functions defined therein.

To work round, you could create a shell script, named foo

#!/bin/zsh -f
source ~/.zshrc   # or just the desired function to save parsing time
# use some functions defined in ~/.zshrc
print "FOO"```

source http://superuser.com/questions/690702/can-i-use-the-output-from-a-zsh-custom-function-in-tmuxs-status-bar

I'm just going to publish it as an npm. If someone complains, I'll add it somewhere else.