Tmux plugin that displays weather forecast using wttr.in in the status bar.
The plugin introduces a new #{forecast}
format.
Thanks to Rahul Rai for the inspiration, I just packaged it. 😉
Add #{forecast}
to your existing status-right
tmux option:
set -g status-right '#{forecast} | #H'
You'll now see some information like so:
Partly cloudy +13°C ↘13km/h | AaronSB2
By default the format string used is %C+%t+%w
, but you can override this with the @forecast-format
option:
set -g @forecast-format '%C'+'|'+'Dusk:'+'%d'
Refer to wttr.in for format options.
Additionally, you might want to specify the location manually, you can do so with the @forecast-location
option:
set -g @forecast-location London
Refer to wttr.in for location options.
Moreover a character limit is enforced, in order to avoid errors trashing your status bar. This limit defaults to 75, but you can increase/decrease it as you wish:
set -g @forecast-char-limit 30
The default forecast language is English. You can change this using a two-letter language code
set -g @forecast-language "nl"
It's possible to enable cache for weather data in file and use it instead of spamming wttr.in service. Weather (and forecast) doesn't change every minute (or even every second) so no need to add extra load on wttr.in in case your status-line updated quite often. To enable caching just set its duration in seconds
set -g @forecast-cache-duration 900 # 15 minutes
There is also an option where to store the cache file
# this is the default
set -g @forecast-cache-path "/tmp/tmux-weather.cache"
Installation with Tmux Plugin Manager (recommended)
Add plugin to the list of TPM plugins in .tmux.conf
:
set -g @plugin 'aaronpowell/tmux-weather'
Hit prefix + I
to fetch the plugin and source it.
#{forecast}
interpolation should now work.
Clone the repo:
$ git clone https://github.com/aaronpowell/tmux-weather ~/clone/path
Add this line to the bottom of .tmux.conf
:
run-shell ~/clone/path/weather.tmux
Reload TMUX environment:
# type this in terminal
$ tmux source-file ~/.tmux.conf
#{forecast}
interpolation should now work.