# fluxMoon

A Window Maker style moon phase dockapp for the Fluxbox slit. Displays a
textured moon with phase shadow, earthshine, and limb darkening. Left-click
shows a popup with rise/set/transit times from fluxData.

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

## Screenshot

```
┌──────────┐
│          │
│   🌒     │  ← textured moon with phase shadow
│          │
│──────────│
│ Wax Cres │
│   42%    │
└──────────┘
```

## Installation

Requires Rust and a working X11 environment.

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

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

## Usage

```
fluxMoon [OPTIONS]
```

Add `fluxMoon` 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 |
| `--southern` | Southern hemisphere (flips illumination side) |
| `--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 moon info 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`:
- Phase name and illumination percentage
- Moonrise, moonset, and transit times
- Next full moon and new moon dates

## Configuration

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

Generate an annotated config:

```sh
fluxMoon --write-config
```

Or use the interactive wizard:

```sh
fluxMoon --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

# Southern hemisphere (flips illumination side)
southern = false

# Left click command (default: toggle moon info popup)
left_click =

# Middle click command
middle_click =

# Right click command
right_click =

# Run as background daemon
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

fluxMoon reads `~/.local/share/fluxData/data.json` for moon rise/set/transit
times and upcoming phase dates. Start fluxData before fluxMoon for full
functionality. The popup will show "fluxData not running" if the data file
is unavailable.

## License

[CC0 1.0](LICENSE) — Public Domain
