# fluxMatrix

A Window Maker style Matrix rain animation dockapp for the Fluxbox slit.
Displays cascading Japanese characters (hiragana and katakana) in the classic
green-on-black Matrix style.

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

## Screenshot

```
┌──────────┐
│ ア  カ   │
│ サ タ ナ │
│    ハ マ │  ← cascading Japanese characters
│ ヤ    ラ │
│ ワ ン あ │
└──────────┘
```

## Installation

Requires Rust and a working X11 environment. A CJK-capable font is recommended
for proper Japanese character rendering.

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

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

## Usage

```
fluxMatrix [OPTIONS]
```

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

### Options

| Flag | Description |
|---|---|
| `--size SIZE` | Window size: 96 (default) or 128 pixels |
| `--speed MS` | Frame interval in milliseconds (default: 80, range: 10-1000) |
| `--density PCT` | Percentage of columns active at once (default: 75, range: 1-100) |
| `--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 | Run `left_click` command (if configured) |
| Middle click | Run `middle_click` command (if configured) |
| Right click | Run `right_click` command (if configured) |

## Configuration

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

Generate an annotated config:

```sh
fluxMatrix --write-config
```

Or use the interactive wizard:

```sh
fluxMatrix --configure
```

### Config options

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

# Frame interval in milliseconds (10-1000)
speed = 80

# Percentage of columns active at once (1-100)
density = 75

# Font file path (leave unset for auto-detect via fontconfig)
# A CJK-capable font is preferred for Japanese characters
font = /path/to/font.ttf

# Head color (R, G, B) — bright leading character
color = 180, 255, 180

# Trail color (R, G, B) — fading trail characters
trail_color = 0, 200, 0

# Click commands
left_click = some-command
middle_click = some-command
right_click = some-command
```

### Font discovery

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

## License

[CC0 1.0](LICENSE) — Public Domain
