This release is a pre-release and may not be stable for production use.
xmobar_wttr is a command-line program which fetches weather info
from wttr.in and applies direct formatting to be used by xmobar.
Different from already available plugins, it can easily be configured
to use any kind of combination of numbers, icons, and colors. It
implements a custom syntax with which a single line in the
xmobar_wttr.yml configuration file translates to an xmobar field entry.
In the commands list of your xmobarrc, add something along the lines
of
Run Com "xmobar_wttr" ["-c", "~/.config/xmobar/xmobar_wttr.yml"] "wttr" 9000
Prerequisites
This program mainly uses following python3 modules
- requests
- pyyaml
Furthermore, the program uses weather icons from https://github.com/erikflowers/weather-icons. Install them directly from the website, using an AUR helper such as
yay -S ttf-weather-icons
or by other means.
Install
pip install xmobar-wttr
For installing from source, clone the repository, and run
cd xmobar_wttr
python setup.py install --user
or create a virtual environment with
pipenv install
pipenv install -e .
To activate the virtual environment run
pipenv shell
or start every command with pipenv run.
Usage
usage: xmobar_wttr [-h] [-c <path>] [-l <loc>] [-f <format>] [-o <path>] [-s <section>] [-p <par-list> [<par-list> ...]] [-v]
optional arguments:
-h, --help show this help message and exit
-c <path>, --config <path>
Path to the config file
-l <loc>, --location <loc>
Location for which to pull information.
-f <format>, --format <format>
Format template for xmobarrc
-o <path>, --output <path>
Path to the output file
-s <section>, --section <section>
Section in the yaml file to be parsed
-p <par-list> [<par-list> ...], --pars <par-list> [<par-list> ...]
Select parameters to be fetched from wttr.in
excluded parameters are not available in xmobar template format
-v, --verbose Run program in verbose mode
Configuration
xmobar_wttr works with both command-line arguments as well as YAML
configuration files (the first takes precedence over the latter). To
set your desired defaults edit the configuration file
xmobar_wttr.yml and place it in either
~/.config/xmobar_wttr/xmobar_wttr.yml~/.config/xmobar/xmobar_wttr.yml~/.xmobar_wttr/xmobar_wttr.yml~/.xmobar_wttr.yml
Notation
- Fields are separated by
%. - Each field should have a parameter entry prefixed by an exclamation
mark
!, e.g.!h. - Units can be placed using
.u - Fonts can be selected using
<N:...>whereNis the xmobar font index, e.g.<2:weather condition>formats to<fn=2>weather condition</fn> - Analogously colors can be used using
{#dedede:...}.
| Notation | *Description |
|---|---|
| %[!par] | parameter value |
| %g[!par] | render parameter only as icon |
| %G[!par] | prefix icon to parameter value |
| .u | append units of previous parameter |
| Format map | Result |
|---|---|
| <2:…> | <fn=2>…</fn> |
| {#dedede:…} | <fc=#dedede>…</fc> |
| \… | \x… |
Example:
'%g!x %!t(%!f)<1: >.u {#46d9ff:%G}<1: >!h'
could format to something like
<fn=6></fn> 3(1)<fn=1> </fn>°C <fc=#46d9ff><fn=6></fn></fc><fn=1> </fn>81
and renders in xmobar as
Metadata
Release files for xmobar-wttr 0.3a0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| xmobar_wttr-0.3a0.tar.gz | 25.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| xmobar_wttr-0.3a0-py3.10.egg | Legacy Egg format | - | - | Details |
Total release size: 50.9 kB
Release files / xmobar_wttr-0.3a0.tar.gz
| Download URL | xmobar_wttr-0.3a0.tar.gz |
|---|---|
| Size | 25.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
95c5d2178823584506e4f5878cb4ca8b1657b86f6bd5641968b2791750a1c8a5
|
|
BLAKE2b-256 checksum How to use checksums |
ed235ef57097d834d1596b01e63a638ab186f7226965081eea8ff23f2b273059
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.10.8
|
Release files / xmobar_wttr-0.3a0-py3.10.egg
| Download URL | xmobar_wttr-0.3a0-py3.10.egg |
|---|---|
| Size | 25.7 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
bc6ecb54bc171214aaa1069b40d16e49634fdfeac76b478bf9f53dd0117d1196
|
|
BLAKE2b-256 checksum How to use checksums |
258fcd49b93640b49835b445133357759518ee4210f5358b7953d1074bd40220
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.10.8
|