-
Notifications
You must be signed in to change notification settings - Fork 0
/
tmux-weather-info-yr.tmux
executable file
·39 lines (30 loc) · 1.24 KB
/
tmux-weather-info-yr.tmux
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env bash
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$CURRENT_DIR/scripts/helpers.sh"
weather_temperature="#($CURRENT_DIR/scripts/get_weather_info.sh)"
weather_temperature_interpolation="\#{weather_temperature}"
weather_symbol="#($CURRENT_DIR/scripts/get_symbol.sh)"
weather_symbol_interpolation="\#{weather_symbol}"
weather_symbol_plaintext="#($CURRENT_DIR/scripts/get_symbol_plaintext.sh)"
weather_symbol_plaintext_interpolation="\#{weather_symbol_plaintext}"
weather_city="#($CURRENT_DIR/scripts/get_city.sh)"
weather_city_interpolation="\#{weather_city}"
do_interpolation() {
local string=$1
local string=${string/$weather_symbol_interpolation/$weather_symbol}
local string=${string/$weather_symbol_plaintext_interpolation/$weather_symbol_plaintext}
local string=${string/$weather_city_interpolation/$weather_city}
local string=${string/$weather_temperature_interpolation/$weather_temperature}
echo "$string"
}
update_tmux_option() {
local option="$1"
local option_value="$(get_tmux_option "$option")"
local new_option_value="$(do_interpolation "$option_value")"
set_tmux_option "$option" "$new_option_value"
}
main() {
update_tmux_option "status-right"
update_tmux_option "status-left"
}
main