I want the name of a program (a string, not the actual name) to show up in the tmux status bar if that program is running.
This is what i have in my set -g status-right
:
#{?#{!=:#(getPid p),0},program,}
Where:
#(getPid p)
is the script i'm running, which returns 0 if the program is not running or not 0 (a PID or wc -l) otherwise#{!=:#(getPid p),program,}
should return 1 or 0 depending on the result of the previous step#{?#{!=:#(getPid p),0},program,}
should print "program" if the previous step returns 1
But i can't even print 1 or 0 with just the first step #{!=:#(getPid p),0}
.
I'm not sure if this is supported, maybe only #{}
flags are supported on conditionals, not #()
EDIT
I'm down to #(getPid p | awk '$0 != 0 {print \"program\"}')
which seems simpler, but still a no go.
EDIT
Another approach that also works on the command-line: if [ $(getPid b) != 0 ]; then echo program; fi
, still nothing on the status bar.
EDIT
I decided to make my script echo the program name, so all i need is #(getPid p)
, but still no go. I think the problem is probably elsewhere. This is the full line:
set -g status-right "#(getName p) |#[fg=colour239,bg=colour236,nobold,nounderscore,noitalics]#[fg=colour253,bg=colour239] %Y-%m-%d | %H:%M #[fg=colour103,bg=colour239,nobold,nounderscore,noitalics]#[fg=colour236,bg=colour103]"