# fluxWeather

A Window Maker style weather dockapp for the Fluxbox slit. Displays
temperature in both Fahrenheit and Celsius with a weather condition label
from WMO codes. Left-click shows a detailed popup with humidity, wind,
pressure, and cloud cover.

Part of the [Flux Dock Apps Suite](https://osugisakae.com/software/flux-dock-apps/).

## Screenshot

```
┌──────────────┐
│     72°F     │  ← Fahrenheit (large)
│     22°C     │  ← Celsius (smaller)
│──────────────│
│   PT CLOUDY  │  ← WMO weather condition
└──────────────┘
```

## Installation

Requires Rust and a working X11 environment.

```sh
cargo build --release
cp target/release/fluxWeather ~/.local/bin/
```

The release build is stripped and LTO-optimized. No runtime dependencies beyond
libc and libX11.

## Usage

```
fluxWeather [OPTIONS]
```

Add `fluxWeather` to your Fluxbox startup to embed it in the slit.

### Options

| Flag | Description |
|---|---|
| `--size SIZE` | Window size: 64, 96 (default), or 128 pixels |
| `--font PATH` | Path to a TTF/OTF font file |
| `--background`, `--bg` | Run in background |
| `--write-config [PATH]` | Write annotated config file and exit |
| `--configure` | Interactive configuration wizard |
| `--help` | Show help message |

### Click behavior

| Button | Action |
|---|---|
| Left click | Toggle weather detail popup (or run `left_click` command) |
| Middle click | Run `middle_click` command (if configured) |
| Right click | Run `right_click` command (if configured) |

### Popup info

The left-click popup shows data from fluxData's `data.json`:
- Temperature (°F and °C)
- Weather condition
- Humidity
- Wind speed and compass direction
- Barometric pressure
- Cloud cover percentage

The popup re-renders when data changes while visible.

### Weather conditions

WMO code labels: CLEAR, FAIR, PT CLOUDY, OVERCAST, FOG, DRIZZLE, FZ DRZL,
LT RAIN, RAIN, HV RAIN, FZ RAIN, LT SNOW, SNOW, HV SNOW, GRAINS, SHOWERS,
FLURRIES, STORM, HAIL.

## Configuration

Config file: `~/.config/fluxWeather/config`

Generate an annotated config:

```sh
fluxWeather --write-config
```

Or use the interactive wizard:

```sh
fluxWeather --configure
```

### Config options

```ini
# Window size: 64, 96, or 128 pixels
size = 96

# Font file path (leave unset for auto-detect via fontconfig)
font = /path/to/font.ttf

# Main color (R, G, B)
color = 0, 255, 0

# Dim color (R, G, B)
dim_color = 0, 200, 0

# Left click command (default: toggle weather detail popup)
left_click =

# Middle click command
middle_click =

# Right click command
right_click =

# Run in the background
background = true
```

### Font discovery

Font is resolved in order:
1. `--font` flag or `font` config option
2. fontconfig (`fc-match monospace`)
3. Hardcoded paths (DejaVu Sans Mono, Liberation Mono, Noto Sans Mono)

### fluxData integration

fluxWeather reads `~/.local/share/fluxData/data.json` for weather data. Start
fluxData before fluxWeather for full functionality. Shows "NO DATA" in dim
color when the data file is unavailable.

## License

[CC0 1.0](LICENSE) — Public Domain
