status-right.sh 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #!/usr/bin/env bash
  2. # This script prints a string will be evaluated for text attributes (but not shell commands) by tmux. It consists of a bunch of segments that are simple shell scripts/programs that output the information to show. For each segment the desired foreground and background color can be specified as well as what separator to use. The script the glues together these segments dynamically so that if one script suddenly does not output anything (= nothing should be shown) the separator colors will be nicely handled.
  3. # custom left/right status and segments
  4. custom_dir=$(dirname $0)
  5. # The powerline root directory. TODO any other neater way of getting fullpath?
  6. cd ~/dotfiles/tmux/tmux-powerline
  7. cwd=$(pwd)
  8. # Source global configurations.
  9. source "${custom_dir}/config.sh"
  10. # Source lib functions.
  11. source "${cwd}/lib.sh"
  12. segments_path="${cwd}/${segments_dir}"
  13. custom_segments_path="${custom_dir}/${segments_dir}"
  14. # Mute this statusbar?
  15. mute_status_check "right"
  16. # Segment
  17. # Comment/uncomment the register function call to enable or disable a segment.
  18. declare -A weather
  19. weather+=(["script"]="${custom_segments_path}/weather.sh")
  20. weather+=(["foreground"]="colour255")
  21. weather+=(["background"]="colour37")
  22. weather+=(["separator"]="${separator_left_bold}")
  23. #register_segment "weather"
  24. declare -A date_day
  25. date_day+=(["script"]="${segments_path}/date_day.sh")
  26. date_day+=(["foreground"]="colour136")
  27. date_day+=(["background"]="colour235")
  28. date_day+=(["separator"]="${separator_left_bold}")
  29. register_segment "date_day"
  30. declare -A date_full
  31. date_full+=(["script"]="${segments_path}/date_full.sh")
  32. date_full+=(["foreground"]="colour136")
  33. date_full+=(["background"]="colour235")
  34. date_full+=(["separator"]="${separator_left_thin}")
  35. date_full+=(["separator_fg"]="default")
  36. register_segment "date_full"
  37. declare -A time
  38. time+=(["script"]="${segments_path}/time.sh")
  39. time+=(["foreground"]="colour136")
  40. time+=(["background"]="colour235")
  41. time+=(["separator"]="${separator_left_thin}")
  42. time+=(["separator_fg"]="default")
  43. register_segment "time"
  44. # Print the status line in the order of registration above.
  45. print_status_line_right
  46. exit 0