docs: refresh all guides and regenerate mixer screenshots
Rust CI fader_master passed its selected CI mode.
MadGobblins/fader_master/pipeline/head This commit looks good Details

Bring README, architecture, backlog, checklist, steward baseline, and every docs guide up to date. Document unnamed spacers, current setup/save/restart behavior, MIDI feedback and portable builds. Replace both screenshots with current representative layouts and fixed cell-grid SVG text/border rendering.

Validation PASS: local file links across all 12 Markdown documents; both SVGs parsed and visually inspected after rsvg-convert; repeated doc_screenshots generation produced identical SHA-256 hashes; git diff --check; cargo fmt --all -- --check; cargo check --workspace --all-targets --all-features; cargo clippy --workspace --all-targets --all-features -- -D warnings; canonical architecture-profile schema test; portable no-default-feature package check. Full workspace gates passed in preceding empty-separator implementation commit.
This commit is contained in:
Dandaedre 2026-10-16 19:38:59 +02:00
parent 33798eeb6e
commit 8add95df3f
Signed by: Dandaedre
GPG Key ID: 440C6592E8A26D99
15 changed files with 5567 additions and 647 deletions

View File

@ -43,4 +43,4 @@ cargo build --workspace --release --all-features
Also test the default build, no-default-features build, and each optional backend independently once feature flags exist. Provision native development libraries in CI. Hardware-free domain, fake-adapter, config, and TUI tests must run without an audio daemon or USB device. Keep real audio/hardware checks separately opt-in and document their fixtures and prerequisites. Add property tests for numerical conversions and state invariants; use a fake clock for retries and coalescing. Test observable behavior, including failure paths, rather than private implementation details.
Current baseline: Rust 1.88.0 is pinned, domain/config crate boundaries exist, and M1 domain contracts are implemented. Runtime adapters, configuration, and the executable remain scaffold work. The `implementation-start` tag marks the original CI coverage/badge baseline. M0.2 awaits real Jenkins verification; the next implementation milestone is M2 in `task.md`.
Current baseline (2026-10-16): Rust 1.88.0 is pinned. Native MIDI/Pulse workers, live IPC/TUI, managed profiles, MIDI learn/feedback, and persisted mixer editing are implemented. The `implementation-start` tag marks the original CI coverage/badge baseline. Follow unchecked acceptance criteria in `task.md`; do not restart completed foundation work. M0.2 still awaits provisioned Linux Jenkins verification, and native PipeWire and runtime relative groups remain unfinished. Keep save/reload/server-restart coverage for layout order and preserve user-edited example profiles.

View File

@ -10,8 +10,9 @@ output, while the terminal UI remains useful as a complete software mixer.
![Horizontal mixer showing application, group, and output faders](docs/images/mixer-horizontal.svg)
The horizontal layout puts conventional bottom-up faders side by side. The
same profile can switch to a compact stacked layout for narrow terminals:
The horizontal layout puts bottom-up faders side by side, with dividers and
flexible spacers between sections. Switch to Vertical in Config for stacked
cards, including one-row Slim and Bordered slim faders:
![Vertical mixer showing stacked faders and separators](docs/images/mixer-vertical.svg)
@ -24,10 +25,14 @@ same profile can switch to a compact stacked layout for narrow terminals:
- Learn volume and mute controls from MIDI, reflect confirmed mute state on
control-surface LEDs, use pickup to prevent jumps, and
keep independently identified controllers from colliding.
- Arrange faders and named separators directly in the mixer. Choose Slim,
- Arrange faders, separators, and empty spacers directly in the mixer. Choose Slim,
Bordered slim, Standard, or Thick faders, and hide detail faders behind a
group when useful.
- Size separators independently and choose Plain, Line, Double line, or Box.
Fill separators share spare space; names are optional.
- Use horizontal or vertical layouts and six built-in terminal themes.
- Choose Detailed, Compact, Symbol, Color, or Hidden pickup feedback in Config.
Hiding the indicator keeps pickup protection active.
- Run as one command, or keep a standalone server alive while reconnecting TUI
clients come and go.
- Edit a validated draft from the TUI and persist it with one explicit Save.
@ -47,8 +52,13 @@ cargo run --locked -p fader_master -- \
```
The combined executable connects to an existing per-user server when possible
and starts an embedded one otherwise. Running without `--config` creates a
safe empty `default` profile on first use, which can then be edited in the TUI.
and starts an embedded one otherwise. Running without `--config` creates
a `default` profile with a Master-output fader. A sole detected MIDI input is
adopted as the default controller; otherwise choose a detected input in Config,
add it, and Save. Edit the Master fader with `E` to learn volume and mute controls.
The screenshots use reproducible example state rendered by the actual TUI;
they do not represent a live hardware session.
## Everyday controls
@ -67,6 +77,12 @@ Use `Tab` to open Config, `T` to cycle the theme, and `Q` to open the quit
confirmation. Fader editing exposes capture rules, group membership, separate
controller/Learn/Unlearn actions for volume and mute, size, and visibility.
Config → Active profile opens the profile switcher.
Separator editing offers an optional name, size, and decoration; an empty
name with Plain + Fill creates flexible blank space. Press Enter to accept
popup edits, then use Config → Save to persist the draft.
After updating the binaries, restart the server as well as the client. The
combined launcher reuses an already-running server.
## Documentation

View File

@ -1,12 +1,17 @@
# fader_master architecture
Status: design researched 2026-10-05; foundation and the M1–M3 hardware-free
domain, persistence, reducer, bounded dispatch, fake-adapter, and lifecycle
milestones are implemented. The executable launches an interactive Ratatui mixer
shell backed by explicitly labeled demo state. Native workers, live TUI state,
and native adapters below are planned, not shipped.
Status as of 2026-10-16: the Linux server runs native MIDI and Pulse-compatible
audio workers, a reconnecting live TUI, managed profiles, MIDI learn and mute
feedback, and a persisted mixer/configuration editor. The combined launcher
starts a server only when none is available. Layouts include horizontal strips,
stacked faders, configurable separators/spacers, themes, and pickup indicators.
Native PipeWire, runtime relative groups, and the unchecked acceptance work in
`task.md` remain unfinished.
## Implemented boundary at M2 entry
## Foundation and implementation history
The following foundation notes describe the original milestone boundaries;
the runtime and UI contracts later in this document describe the current system.
Rust 1.88.0 is the pinned toolchain and tested MSRV. The workspace inherits
package metadata, including the existing custom `LICENSE` through `license-file`.
@ -535,8 +540,9 @@ chosen as members. Absolute remains the only selectable group mode until the
reserved relative-mode runtime work is complete.
The secondary Config tab is not an alternative object editor. It presents
profile theme selection, a popup listing all hidden faders for individual
restoration, unsaved and Save state, active profile/backend status, MIDI-learn
profile theme, mixer orientation and pickup-status selection, a popup listing
all hidden faders for individual restoration, unsaved and Save state, active
profile/backend status, MIDI-learn
cancellation, and MIDI device diagnostics. Object and layout edits stay on the
main mixer. There is no separate hidden-fader mode: hidden rows disappear from
the mixer and are restored from this popup at their retained layout positions.

View File

@ -1,8 +1,9 @@
# fader_master hands-on checklist (Arch + PipeWire)
Automated tests cover validation, buffering, IPC, rollback, rendering, and
atomic persistence. This checklist is only for behavior requiring your real
PipeWire session, APC MINI, applications, and terminal.
atomic persistence. This checklist records manual acceptance with your real
PipeWire session, APC MINI, applications, and terminal. Existing checked items
are historical observations; the new unchecked items still need manual testing.
## Setup
@ -10,8 +11,7 @@ Use a disposable profile directory so editor Save does not modify tracked
examples:
```sh
work=/tmp/fader-master-check
mkdir -p "$work"
work=$(mktemp -d /tmp/fader-master-check.XXXXXX)
cp examples/profiles/{arch-pipewire,desktop}.toml "$work/"
cargo run --locked -p fader_master -- serve \
--config "$work/arch-pipewire.toml" --audio pulse
@ -23,6 +23,9 @@ In another terminal:
cargo run --locked -p fader_master -- tui
```
Restart the server too after rebuilding. A new client or all-in-one launcher
can reconnect to an old server process; it cannot replace its implementation.
Known mappings: Music `CC48/Note64`, Browser `CC49/Note65`, Media sync
`CC50/Note66`, and Master `CC56/Note98`. The profile polling interval is 10 ms
and accepts 1–100 ms.
@ -72,8 +75,28 @@ cargo run --locked -p fader_master -- profile switch arch-pipewire
- [ ] Run `cargo run --locked -p fader_master -- status`; confirm `status=ready`
and expected final values.
- [ ] Report any pre-pickup jump, wrong target, rough sweep, stale/pending value,
lost mute edge, failed apply/save diagnostic, reconnect over one second,
lost mute edge, failed Save diagnostic, reconnect over one second,
terminal corruption, or process exit.
Explicit `profile switch --restore` is automated but remains optional for manual
testing until the MIDI output-feedback milestone is implemented.
Explicit `profile switch --restore` remains optional for manual testing because
it deliberately writes saved state. Mute LED feedback is implemented; verify
the configured on/off values against the particular surface.
## Layout, settings, and persistence
- [ ] Move a fader in both directions, Save, restart the server, and move it
again. Verify that selection follows it and the order never snaps back.
- [ ] Add and rename separators with both nonempty and empty names. Create two
unnamed separators and verify they remain independently editable/movable.
- [ ] Try separator Slim/Standard/Thick/Fill and all four decorations in both
orientations. Plain + empty name should be blank space; unnamed lines should
be continuous. Multiple Fill separators should share leftover space.
- [ ] Try Slim, Bordered slim, Standard, and Thick faders. Resize the terminal:
horizontal entries should stay on one row, and selection should stay visible.
- [ ] Change theme, orientation, and each pickup-status mode in Config. Save
and restart; all choices should persist. Hidden pickup status must not disable
the hardware pickup behavior.
- [ ] Hide an application fader used by a group, then restore it from the
Config popup. Verify that its MIDI binding and group membership still work.
- [ ] Relearn a mute button, Save, and confirm only the new button controls it
and receives feedback. Open Help with h/?; Escape closes popups, Q confirms quit.

View File

@ -10,6 +10,12 @@
- [Example desktop profile](../examples/profiles/desktop.toml)
- [Hands-on functional checklist](../checklist.md)
For everyday layout editing: select a fader or separator and press `E`.
Separators accept empty names, independent size and decoration, and Fill space.
Config contains theme/orientation/pickup display, hidden-fader restoration,
profile switching, MIDI devices, and Save. See the
[mixer presentation reference](configuration.md#mixer-presentation).
## Design and development
- [Architecture and library research](../architecture.md)
@ -23,9 +29,24 @@
- [Related projects and libraries](related-projects.md)
The README screenshots are deterministic renders of the real TUI. Regenerate
them after presentation changes with:
## Screenshot maintenance
Both README screenshots are deterministic renders of the real TUI using
example state, not captures of a live audio session:
- [Horizontal mixer](images/mixer-horizontal.svg): five side-by-side faders,
a double divider, an unnamed Fill spacer, mute and group-mixed state.
- [Vertical mixer](images/mixer-vertical.svg): section labels, Standard,
Slim and Bordered slim rows, and the default output.
Regenerate all screenshots after presentation changes:
```sh
cargo run --locked -p tui --example doc_screenshots
```
The generator lives in [doc_screenshots.rs](../tui/examples/doc_screenshots.rs).
It places text on the terminal cell grid and draws box/block glyphs to cell
edges so font differences do not break borders or meters. Inspect both SVGs
in a browser or rasterize with `rsvg-convert` for review; confirm every fader,
label and keyboard hint is visible. Do not hand-edit the generated SVG files.

View File

@ -33,13 +33,32 @@ through `pipewire-pulse`; it does not require the standalone PulseAudio server.
The Pulse adapter works with PulseAudio and PipeWire's pipewire-pulse
compatibility service. MIDI input uses ALSA's sequencer API through `midir`, and
Linux identity enrichment uses libudev. PipeWire does not replace the
`alsa-lib` build dependency. A build that deliberately excludes native audio
and MIDI dependencies remains available:
`alsa-lib` build dependency. To exclude native audio and MIDI dependencies,
build the portable library/TUI subset used on FreeBSD and explicitly omit the
Linux executable:
```sh
cargo build --workspace --no-default-features --locked
cargo build --locked --no-default-features \
-p fader-core -p fader-config -p midi -p volume_lib -p tui
```
`--workspace --no-default-features` alone is not a native-free build: the
executable's dependencies still enable the native MIDI and Pulse features.
The normal Linux release build produces all three entry points:
```sh
cargo build --locked --workspace --release --all-features
./target/release/fader_master
# Or run separately, in two terminals:
./target/release/fader_master_server
./target/release/fader_master_client
```
Restart both server and client when upgrading, including an external server
that the all-in-one launcher might reuse. First-run configuration and MIDI
setup are described in [Advanced configuration](configuration.md).
Future native PipeWire and ALSA mixer adapters will add their own feature-gated
development packages. The MIDI crate can also be checked without its native
transport and identity discovery while retaining byte decoding and routing:

View File

@ -1,5 +1,11 @@
# CI coverage and badge lifecycle
See [Build prerequisites](build.md) for the native and portable build commands.
TUI rendering, separator presentation, and configuration round-trip tests are
part of the portable suites. Unix-socket/server-restart tests require the
Linux executable test suite; real audio fixtures remain separately opt-in.
README screenshots are generated documentation assets, not coverage badges.
The generic renderer in `scripts/ci-coverage-badges.sh` is copied unchanged
from `Dandaedre/agent-tasks` revision
`fb9d8f7d16f100c2d1377f23394a2302eac9ab18`.

View File

@ -29,6 +29,10 @@ running outside the normal XDG runtime location. `--theme THEME` is a client
session override; changing the theme in the TUI updates the profile draft, and
Config → Save persists it.
When connecting to an existing server, its active profile and audio backend
remain authoritative. Restart both processes after a binary update; a new
client cannot update the code inside an already-running server.
## Managed profiles and files
Without `--config`, fader_master uses the XDG layout:
@ -194,6 +198,22 @@ columns, Standard fits the label within 8–18 columns, and Thick uses 22.
Fill shares unused viewport space with other Fill separators after faders
have been fitted, so it does not force faders off-screen or cause wrapping.
Separator names are optional. Keep a stable nonempty `id`, but use `label = ""`
for an unlabelled rule, box, or spacer:
```toml
[[mixer_layout]]
kind = "separator"
id = "before-master"
label = ""
size = "fill"
decoration = "plain"
```
Size and decoration are independent. An unnamed Line or Double separator
draws an uninterrupted rule; Plain draws only empty space. Reordering keeps
the entry's ID, appearance, and comments, including after Save and restart.
### MIDI surfaces and bindings
Use `fader_master devices` to inspect available ports and durable USB identity
@ -222,6 +242,11 @@ feedback = { kind = "note", channel = 1, number = 64, on = 127, off = 0 }
The TUI can choose a controller, learn the next supported movement or button
press, and remove an assignment independently for volume and mute. Unassigned
actions inherit `[ui].default_controller` for learning.
Learn opens a modal waiting for a movement or button press; Escape cancels it.
Changing controller, learning, and unlearning are separate actions. In Config,
open a MIDI device to see its connection details and set its default-controller
flag. Hidden faders remain bound and continue contributing to groups; restore
them from Config → Show hidden faders.
`feedback` is optional and requires the binding's surface to define
`output_port`. After that output attaches, the server sends `on` when the
@ -232,6 +257,12 @@ lights an LED as if it succeeded. Reconnect sends the current state again;
unchanged states are deduplicated. Both note and CC feedback use 1-based
channels and values from 0–127.
LED values are device-specific: a note velocity can mean a color or animation,
so 127 is not a universal “on” value. The APC MINI example uses its configured
green value. Relearning a mute binding moves its feedback assignment to the new
control. Set feedback values and output-port details in the profile when your
surface requires a different protocol.
## Validation, migration, and Save
Validate a file without opening MIDI/audio devices or changing live audio:

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 132 KiB

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 268 KiB

View File

@ -1,4 +1,10 @@
# Linux MIDI identity spike
# Linux MIDI discovery and identity
Run `fader_master devices` to inspect discovered ports. Config lists unclaimed
ports under Detected MIDI ports; open one to add it to the profile, then Save.
Configured MIDI devices have a details popup with connection status, backend
port, errors, and a default-controller toggle. Only a sole detected input is
automatically adopted when a managed profile is first created.
`midir` 0.11.1 exposes Linux ports as ALSA sequencer `client:port` addresses and
human-readable names. Neither value is a durable USB identity: client numbers
@ -36,5 +42,9 @@ would risk controlling the wrong applications.
On 2026-10-14, the Arch Linux host exposed only
`PortIdentity { backend_id: "14:0", name: "Midi Through:Midi Through Port-0 14:0", usb: None }`.
This validates the virtual-client fallback but is not physical-controller
acceptance. The controller observations requested in `checklist.md` must be
recorded before M5.2 is marked complete.
acceptance. A later APC MINI observation on 2026-10-15 recorded USB
`09e8:0028`, serial `Ver00.10`, and backend port `36:0`; the serial stayed
stable when the USB socket changed. Two-identical-device ambiguity checks
remain open in [the backlog](../task.md) and
[hands-on checklist](../checklist.md). These are recorded observations, not
guarantees that every controller exposes a unique serial.

View File

@ -5,6 +5,12 @@ session. Its normal phase creates a uniquely named, silent stereo stream with
`paplay`, changes only that stream, and always terminates the child process.
It never parses shell output in the production adapter.
This fixture tests audio behavior, not screenshots or the separator editor.
Layout, blank-name, save/reload, and rendering tests run in the ordinary
hardware-free suite. For interactive layout/MIDI checks, use the
[hands-on checklist](../checklist.md); for deterministic screenshots, see
[the documentation index](README.md).
## Prerequisites
- A reachable PulseAudio-compatible server. This can be PulseAudio itself or

View File

@ -17,3 +17,9 @@ layers used by fader_master:
The detailed dependency choices, constraints, and licenses are recorded in the
[architecture research table](../architecture.md#library-research-and-choices).
Only the Pulse-compatible audio adapter is currently available at runtime;
PipeWire users connect through `pipewire-pulse`. The interface screenshots
are generated from fader_master's own Ratatui renderer. See
[configuration](configuration.md) for supported behavior and
[build instructions](build.md) for the pinned dependency/toolchain setup.

13
task.md
View File

@ -4,6 +4,12 @@ This is the build plan for `architecture.md`. Checked boxes record verified acce
## Planning delivered
Current user-facing baseline: live MIDI/Pulse server and TUI, all-in-one or
split processes, managed profile switching, guided fader editing, configurable
separators including unnamed spacers, themes, and pickup presentation.
Historical milestone notes below describe incremental delivery; unchecked
boxes still require their remaining acceptance evidence.
- [x] Inspect the workspace and define the project-steward role in `AGENTS.md`.
- [x] Specify state ownership, adapter boundaries, matching/groups, MIDI identity/feedback, and TOML lifecycle in `architecture.md`.
- [x] Research libraries using linked primary documentation and identify bounded technical spikes.
@ -202,8 +208,8 @@ Dependencies: M3; M4 for full end-to-end acceptance.
APC MINI CC 48/49/50/56 and notes 64/65/66/98 to Music, Browser, Media, and
the default output master. Input targeting an offline/read-only object is a
nonfatal no-op, leaving other targets and the server available. Keep this item
open until pickup state is published to the TUI and profile-switch rearming is
implemented.
open for remaining physical multi-surface acceptance. Pickup snapshots and
profile-switch rearming are now implemented and covered by automated tests.
- [ ] **M5.5 Physical smoke test:** one controller -> server -> application audio; then two controllers with overlapping MIDI message numbers. Acceptance: correct applications respond, bindings persist, and USB loss leaves server running. Record controller/firmware and environment.
M5.1 verification on 2026-10-14: nine decoder/router/transport tests pass with
@ -236,7 +242,8 @@ Dependencies: M3, M2; may proceed after the fake-adapter slice.
- [x] **M7.1 CLI:** serve/tui/validate/devices/status/profile switch arguments and override precedence. Tests: help/errors, invalid config has no side effects, explicit override wins for the session without silently modifying disk.
Typed subcommands now validate profiles before probing audio or creating the
runtime socket. `serve`, `tui`, `validate`, `devices`, and `status` are active;
`profile switch` parsing is reserved for the transactional M10 implementation.
Transactional profile switching is now implemented by M10.1, including the
Config-tab profile picker.
A session audio override is applied only to runtime selection.
- [x] **M7.2 IPC:** owned Unix socket, one-instance lock, version negotiation, length-bounded TOML frames, request IDs and revisioned state. Tests: wrong peer permissions, oversized/truncated/incompatible messages, second server, stale socket recovery and slow/disconnected client.
The first local slice uses an owned mode-0600 socket, bounded request timeouts,

View File

@ -48,14 +48,14 @@ fn main() -> io::Result<()> {
fs::create_dir_all(&output)?;
render(
MixerOrientation::Horizontal,
140,
26,
148,
24,
output.join("mixer-horizontal.svg"),
)?;
render(
MixerOrientation::Vertical,
104,
38,
148,
27,
output.join("mixer-vertical.svg"),
)
}
@ -76,6 +76,7 @@ fn snapshot(mixer_orientation: MixerOrientation) -> MixerSnapshot {
let targets = [
(MixerObjectKind::Application, "music", "Music"),
(MixerObjectKind::Application, "browser", "Browser"),
(MixerObjectKind::Application, "voice", "Voice chat"),
(MixerObjectKind::Group, "media", "Media group"),
(MixerObjectKind::Output, "default", "Master output"),
];
@ -94,13 +95,13 @@ fn snapshot(mixer_orientation: MixerOrientation) -> MixerSnapshot {
MixerObjectKind::Output => "Built-in Audio Analog Stereo",
}
.to_owned(),
gain: Some([0.78, 0.46, 0.62, 0.88][index]),
gain: Some([0.72, 0.38, 0.55, 0.72, 0.86][index]),
gain_mixed: kind == MixerObjectKind::Group,
muted: Some(index == 1),
muted: Some(index == 2),
mute_mixed: kind == MixerObjectKind::Group,
pending: false,
pickup: Some(match index {
0 | 3 => PickupStatus::Tracking,
0 | 2 | 4 => PickupStatus::Tracking,
1 => PickupStatus::Waiting,
_ => PickupStatus::Mixed,
}),
@ -144,7 +145,7 @@ fn snapshot(mixer_orientation: MixerOrientation) -> MixerSnapshot {
profile_id: "desktop".to_owned(),
available_profiles: vec!["desktop".to_owned()],
mixer_orientation,
status_display: tui::StatusDisplayMode::Detailed,
status_display: tui::StatusDisplayMode::Symbol,
default_controller: Some("apc-mini".to_owned()),
theme: ThemeName::CatppuccinMocha,
applications: vec![
@ -158,6 +159,11 @@ fn snapshot(mixer_orientation: MixerOrientation) -> MixerSnapshot {
label: "Browser".to_owned(),
selectors: Vec::new(),
},
ConfiguredApplication {
id: "voice".to_owned(),
label: "Voice chat".to_owned(),
selectors: Vec::new(),
},
],
groups: vec![ConfiguredGroup {
id: "media".to_owned(),
@ -166,44 +172,81 @@ fn snapshot(mixer_orientation: MixerOrientation) -> MixerSnapshot {
volume_mode: GroupVolumeMode::Absolute,
}],
faders,
mixer_layout: vec![
MixerLayoutEntry::Separator {
id: "applications".to_owned(),
label: "Applications".to_owned(),
size: tui::SeparatorSize::Standard,
decoration: tui::SeparatorDecoration::Line,
},
layout_fader(
"music",
horizontal_density(mixer_orientation, FaderDensity::Standard),
),
layout_fader(
"browser",
horizontal_density(mixer_orientation, FaderDensity::Slim),
),
MixerLayoutEntry::Separator {
id: "groups".to_owned(),
label: "Groups".to_owned(),
size: tui::SeparatorSize::Standard,
decoration: tui::SeparatorDecoration::Line,
},
layout_fader("media", FaderDensity::Thick),
MixerLayoutEntry::Separator {
id: "outputs".to_owned(),
label: "Outputs".to_owned(),
size: tui::SeparatorSize::Standard,
decoration: tui::SeparatorDecoration::Line,
},
layout_fader(
"default",
horizontal_density(mixer_orientation, FaderDensity::Standard),
),
],
mixer_layout: if mixer_orientation == MixerOrientation::Horizontal {
vec![
layout_fader("music", FaderDensity::Thick),
layout_fader("browser", FaderDensity::Thick),
layout_fader("voice", FaderDensity::Thick),
separator(
"group-divider",
"",
tui::SeparatorSize::Slim,
tui::SeparatorDecoration::Double,
),
layout_fader("media", FaderDensity::Thick),
separator(
"before-master",
"",
tui::SeparatorSize::Fill,
tui::SeparatorDecoration::Plain,
),
layout_fader("default", FaderDensity::Thick),
]
} else {
vec![
MixerLayoutEntry::Separator {
id: "applications".to_owned(),
label: "Applications".to_owned(),
size: tui::SeparatorSize::Slim,
decoration: tui::SeparatorDecoration::Double,
},
layout_fader(
"music",
horizontal_density(mixer_orientation, FaderDensity::Standard),
),
layout_fader(
"browser",
horizontal_density(mixer_orientation, FaderDensity::Slim),
),
layout_fader("voice", FaderDensity::BorderedSlim),
MixerLayoutEntry::Separator {
id: "groups".to_owned(),
label: "Groups".to_owned(),
size: tui::SeparatorSize::Slim,
decoration: tui::SeparatorDecoration::Line,
},
layout_fader("media", FaderDensity::Standard),
MixerLayoutEntry::Separator {
id: "outputs".to_owned(),
label: "Outputs".to_owned(),
size: tui::SeparatorSize::Slim,
decoration: tui::SeparatorDecoration::Line,
},
layout_fader(
"default",
horizontal_density(mixer_orientation, FaderDensity::Standard),
),
]
},
bindings: Vec::new(),
},
}
}
fn separator(
id: &str,
label: &str,
size: tui::SeparatorSize,
decoration: tui::SeparatorDecoration,
) -> MixerLayoutEntry {
MixerLayoutEntry::Separator {
id: id.to_owned(),
label: label.to_owned(),
size,
decoration,
}
}
const fn horizontal_density(
orientation: MixerOrientation,
vertical_density: FaderDensity,
@ -248,18 +291,13 @@ fn buffer_svg(buffer: &Buffer) -> String {
}
start = end;
}
let mut start = 0;
while start < buffer.area.width {
let cell = &buffer[(start, y)];
let mut end = start + 1;
let mut text = cell.symbol().to_owned();
while end < buffer.area.width {
let next = &buffer[(end, y)];
if next.fg != cell.fg || next.modifier != cell.modifier {
break;
}
text.push_str(next.symbol());
end += 1;
for x in 0..buffer.area.width {
let cell = &buffer[(x, y)];
let text = cell.symbol();
let foreground = color(cell.fg, "#cdd6f4");
if let Some(glyph) = cell_shape(text, x * CELL_WIDTH, y * CELL_HEIGHT, &foreground) {
svg.push_str(&glyph);
continue;
}
if !text.trim().is_empty() {
let weight = if cell.modifier.contains(Modifier::BOLD) {
@ -269,20 +307,58 @@ fn buffer_svg(buffer: &Buffer) -> String {
};
svg.push_str(&format!(
"<text x=\"{}\" y=\"{}\" fill=\"{}\" xml:space=\"preserve\"{}>{}</text>\n",
start * CELL_WIDTH,
x * CELL_WIDTH,
y * CELL_HEIGHT + 1,
color(cell.fg, "#cdd6f4"),
foreground,
weight,
escape_xml(&text)
escape_xml(text)
));
}
start = end;
}
}
svg.push_str("</g>\n</svg>\n");
svg
}
// Draw terminal strokes and blocks to their cell edges. Font metrics vary
// between SVG viewers and otherwise leave gaps in borders and filled meters.
fn cell_shape(symbol: &str, x: u16, y: u16, color: &str) -> Option<String> {
let path = match symbol {
"─" => "M0 9 H9",
"│" => "M4.5 0 V18",
"┌" => "M4.5 18 V9 H9",
"┐" => "M0 9 H4.5 V18",
"└" => "M4.5 0 V9 H9",
"┘" => "M0 9 H4.5 V0",
"╭" => "M4.5 18 V13.5 Q4.5 9 9 9",
"╮" => "M0 9 Q4.5 9 4.5 13.5 V18",
"╰" => "M4.5 0 V4.5 Q4.5 9 9 9",
"╯" => "M0 9 Q4.5 9 4.5 4.5 V0",
"━" => "M0 8 H9 M0 9 H9",
"┃" => "M4 0 V18 M5 0 V18",
"┏" => "M4 18 V8 H9 M5 18 V9 H9",
"┓" => "M0 8 H5 V18 M0 9 H4 V18",
"┗" => "M4 0 V9 H9 M5 0 V8 H9",
"┛" => "M0 9 H5 V0 M0 8 H4 V0",
"═" => "M0 7 H9 M0 11 H9",
"║" => "M3 0 V18 M6 0 V18",
"╔" => "M3 18 V7 H9 M6 18 V11 H9",
"╗" => "M0 7 H6 V18 M0 11 H3 V18",
"╚" => "M3 0 V11 H9 M6 0 V7 H9",
"╝" => "M0 11 H6 V0 M0 7 H3 V0",
"█" | "░" => {
return Some(format!(
"<rect x=\"{x}\" y=\"{y}\" width=\"9\" height=\"18\" fill=\"{color}\" opacity=\"{}\"/>\n",
if symbol == "█" { "1" } else { "0.18" }
));
}
_ => return None,
};
Some(format!(
"<path transform=\"translate({x} {y})\" d=\"{path}\" stroke=\"{color}\" fill=\"none\"/>\n"
))
}
fn color(color: Color, reset: &str) -> String {
match color {
Color::Reset => reset.to_owned(),