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.

33 lines
719 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. ip_address_interpolation_string="\#{ip_address}"
  6. do_interpolation() {
  7. local string="$1"
  8. local ip_addr=$ip_address
  9. if [ -z "$ip_address" ]
  10. then
  11. ip_addr="Offline"
  12. fi
  13. local interpolated="$(echo $1 | sed "s/$ip_address_interpolation_string/$ip_addr/g")"
  14. echo "$interpolated"
  15. }
  16. update_tmux_option() {
  17. local option="$1"
  18. local option_value="$(get_tmux_option "$option")"
  19. local new_option_value="$(do_interpolation "$option_value")"
  20. set_tmux_option "$option" "$new_option_value"
  21. }
  22. main() {
  23. update_tmux_option "status-right"
  24. }
  25. main