Closed artis3n closed 3 years ago
Hello @artis3n 👋
Well first you can make sure your function works by doing
$ cut -c3- ~/.tmux.conf.local | sh -sx vpn
Then did you make sure you reloaded the tmux configuration? Finally, after reloading the tmux configuration can you please paste the output of
$ tmux show -gv status-left
or
$ tmux show -gv status-right
depending on whether you used #{vpn}
in tmux_conf_status_left
or tmux_conf_status_right
?
Looks like it does work:
└─$ cut -c3- ~/.tmux.conf.local | sh -sx vpn
+ :
+ vpn
+ [ -d /proc/sys/net/ipv4/conf/tun0 ]
+ printf VPN 10.10.14.112
VPN 10.10.14.112
I do not see it (I think?) in status-left
, using the format I have in the description:
└─$ tmux show -gv status-left
#[fg=#080808,bg=#ffff00,bold] ❐ #S #[fg=#ffff00,bg=#ff00af,none]#[fg=#e4e4e4,bg=#ff00af,none] ↑#{?@uptime_y, #{@uptime_y}y,}#{?@uptime_dy, #{@uptime_dy}d,}#{?@uptime_h, #{@uptime_h}h,}#{?@uptime_m, #{@uptime_m}m,} #[fg=#ff00af,bg=#080808,none]
Which commit of Oh my tmux! are you using btw?
And does your ~/.tmux.conf.local
file start with
# : << EOF
# https://github.com/gpakosz/.tmux
# (‑●‑●)> dual licensed under the WTFPL v2 license and the MIT license,
# without any warranty.
# Copyright 2012— Gregory Pakosz (@gpakosz).
? The important line is
# : << EOF
Then in your ~/.tmux.conf.local
file you should have
# # /!\ do not remove the following line
# EOF
#
# # /!\ do not "uncomment" the functions: the leading "# " characters are needed
#
# vpn() {
# [ -d /proc/sys/net/ipv4/conf/tun0 ] && printf "VPN $({ ip -4 -br a sh dev tun0 | awk {'print $3'} | cut -f1 -d/; } 2>/dev/null)"
# }
#
# "$@"
# # /!\ do not remove the previous line
Yes - proof in description for how I added the vpn()
function and the top of the file is unchanged, confirmed it has the # : << EOF
line and the github license section.
... I figured starting tmux new
would be sufficient to apply the config. Misunderstood what you meant by reload the tmux configruation.
I ran tmux source-file ~/.tmux.conf
and now the VPN function is applying correctly in my status bar. Thanks for your help :)
You can also use <prefix>
+ r
to reload the configuration
I added a
vpn
variable in.tmux.conf.local
(note the vpn function):Trying to replicate this output from my terminal to the tmux session, but am rather new at this:
I've tried adding the variable to
tmux_conf_theme_status_left
and right but I don't see my expected output:I'm new to using tmux beyond basic commands and customizing my tmux session so I'm sure I'm doing something wrong - just not sure what.