# fluxSun

A Window Maker style sun info dockapp for the Fluxbox slit. Displays a
procedurally drawn sun icon with rise and set times from fluxData. Left-click
shows a detailed popup with transit, twilight, dusk, and day length.

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

## Screenshot

```
┌──────────────┐
│              │
│    ☀        │  ← procedural sun icon with rays
│              │
│  R  06:32    │  ← sunrise
│──────────────│
│  S  20:15    │  ← sunset
└──────────────┘
```

## Installation

Requires Rust and a working X11 environment.

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

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

## Usage

```
fluxSun [OPTIONS]
```

Add `fluxSun` 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 sun 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`:
- Sunrise and sunset times
- Solar transit (noon)
- Civil twilight begin and end
- Day length

## Configuration

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

Generate an annotated config:

```sh
fluxSun --write-config
```

Or use the interactive wizard:

```sh
fluxSun --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 sun 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

fluxSun reads `~/.local/share/fluxData/data.json` for sun rise, set, transit,
and twilight times. Start fluxData before fluxSun for full functionality. Shows
"NO DATA" in dim color when the data file is unavailable.

## License

[CC0 1.0](LICENSE) — Public Domain
