# fluxPlayer

A Window Maker style media player control dockapp for the Fluxbox slit.
Displays a 2x2 grid of icon-only buttons: play/pause, stop, next, and
volume controls.

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

## Screenshot

```
┌───────────────┐
│  ▶/⏸  │  ■   │
│───────────────│
│  ⏭   │ -│ + │
└───────────────┘
```

## Installation

Requires Rust and a working X11 environment.

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

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

## Usage

```
fluxPlayer [OPTIONS]
```

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

### Options

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

### Button layout

```
┌─────────┬─────────┐
│  Play/  │         │
│  Pause  │  Stop   │
├─────────┼────┬────┤
│         │Vol-│Vol+│
│  Next   │  - │ +  │
└─────────┴────┴────┘
```

| Button | Action |
|---|---|
| Play/Pause (top left) | Run `play`/`pause` or `play_pause` command, toggle icon |
| Stop (top right) | Run `stop` command |
| Next (bottom left) | Run `next` command |
| Vol- (bottom right, left half) | Run `volume_down` command |
| Vol+ (bottom right, right half) | Run `volume_up` command |
| Middle click (anywhere) | Run `middle_click` command (if configured) |

Each button highlights briefly on press for visual feedback. All icons are
procedurally drawn with anti-aliasing — no font required.

### Command auto-detection

Commands are resolved in order: **config file > auto-detect**.

Auto-detect probes for the first available player controller:

1. **playerctl** — play-pause, next, stop, volume 0.05+/-
2. **mpc** — toggle, next, stop, volume +/-5
3. **cmus-remote** — -u, -n, -s, -v +/-5%
4. **xdotool** — XF86Audio key simulation (Play, Pause, Stop, Next, RaiseVolume, LowerVolume)

The first controller found in PATH is used for all actions.

**Note:** Auto-detection runs at startup. If you install a new player backend
(e.g. playerctl) after launching fluxPlayer, restart it to pick up the new
commands. If you previously ran `--write-config` or `--configure`, re-run
it to regenerate the config with the new backend.

## Configuration

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

Generate an annotated config with auto-detected commands:

```sh
fluxPlayer --write-config
```

Or use the interactive wizard:

```sh
fluxPlayer --configure
```

### Config options

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

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

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

# Transport commands
play_pause = playerctl play-pause
play = playerctl play
pause = playerctl pause
stop = playerctl stop
next = playerctl next

# Volume commands
volume_up = playerctl volume 0.05+
volume_down = playerctl volume 0.05-

# Middle click command
middle_click =

# Run in the background
background = true
```

## License

[CC0 1.0](LICENSE) — Public Domain
