You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
729 B

  1. #!/usr/bin/env bash
  2. CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
  3. source "$CURRENT_DIR/helpers.sh"
  4. ip_address="$($CURRENT_DIR/ip_address.sh)"
  5. do_interpolation() {
  6. local string="$1"
  7. local ip_addr=$ip_address
  8. if [ -z "$ip_address" ]
  9. then
  10. ip_addr="Offline"
  11. fi
  12. local interpolated="$(echo $1 | sed "s/\(Offline\|[[:digit:]]\{1,3\}\.[[:digit:]]\{1,3\}\.[[:digit:]]\{1,3\}\.[[:digit:]]\{1,3\}\)/$ip_addr/g")"
  13. echo "$interpolated"
  14. }
  15. update_tmux_option() {
  16. local option="$1"
  17. local option_value="$(get_tmux_option "$option")"
  18. local new_option_value="$(do_interpolation "$option_value")"
  19. set_tmux_option "$option" "$new_option_value"
  20. }
  21. main() {
  22. update_tmux_option "status-right"
  23. }
  24. main