### Manual Installation of wiremix with Rust Source: https://github.com/tsowell/wiremix/blob/main/README.md Steps for manually installing wiremix on Ubuntu and Debian systems. This involves installing Rust prerequisites (cargo, libpipewire-0.3-dev, pkg-config, clang) and then using Cargo to install the wiremix package. ```bash # Ubuntu/Debian sudo apt install cargo libpipewire-0.3-dev pkg-config clang # Install Rust toolchain if needed: rustup cargo install wiremix ``` -------------------------------- ### wiremix CLI Usage Examples Source: https://context7.com/tsowell/wiremix/llms.txt Demonstrates various command-line options for launching and configuring wiremix, including specifying configuration files, PipeWire remotes, and UI settings. ```bash # Basic usage - connect to default PipeWire remote wiremix # Use custom configuration file wiremix --config ~/.config/wiremix/custom.toml # Connect to specific PipeWire remote wiremix --remote pipewire-0 # Set framerate limit (60 FPS) wiremix --fps 60 # Start with specific tab view wiremix --tab playback # Disable mouse support wiremix --no-mouse # Use compatibility character set wiremix --char-set compat # Use no-color theme wiremix --theme nocolor # Set maximum volume percentage wiremix --max-volume-percent 100 # Show version information wiremix --version ``` -------------------------------- ### Install wiremix via Package Managers Source: https://github.com/tsowell/wiremix/blob/main/README.md Instructions for installing wiremix using various Linux package managers. This section covers Arch Linux (pacman and AUR), Nix, Gentoo (emerge), and Fedora (dnf). ```bash sudo pacman -S wiremix paru -S wiremix-git nix run nixpkgs#wiremix emerge -av wiremix dnf in wiremix ``` -------------------------------- ### wiremix Rust Library Integration Example Source: https://context7.com/tsowell/wiremix/llms.txt Shows how to use core wiremix components within a Rust application, including setting up event handling, parsing options, loading configuration, and initializing the TUI. ```rust use wiremix::config::Config; use wiremix::opt::Opt; use wiremix::wirehose::Session; use wiremix::event::Event; use wiremix::app::App; use std::sync::{mpsc, Arc}; use anyhow::Result; fn main() -> Result<()> { // Create event channel for PipeWire and input events let (event_tx, event_rx) = mpsc::channel(); let event_tx = Arc::new(event_tx); // Parse command-line options let opt = Opt::parse(); // Load configuration let config_path = opt.config.as_deref() .or(Config::default_path().as_deref()); let config = Config::try_new(config_path, &opt)?; // Set up PipeWire event handler let event_handler = { let event_tx = Arc::clone(&event_tx); move |event| event_tx.send(Event::Pipewire(event)).is_ok() }; // Spawn PipeWire monitoring session let client = Session::spawn(config.remote.clone(), event_handler)?; // Initialize terminal UI let mut terminal = ratatui::init(); terminal.clear()?; // Run the application let app_result = App::new(&client, event_rx, config).run(&mut terminal); // Cleanup ratatui::restore(); app_result } ``` -------------------------------- ### Application-Specific Name Template Overrides Source: https://context7.com/tsowell/wiremix/llms.txt Provides examples of overriding default name templates for specific applications or devices. This allows for custom display names based on certain properties like 'node.name' or 'device.name'. ```toml [[names.overrides]] types = [ "stream" ] property = "node.name" value = "firefox" templates = [ "Firefox: {node:media.name}" ] [[names.overrides]] types = [ "stream" ] property = "node.name" value = "mpv" templates = [ "{node:media.name}" ] [[names.overrides]] types = [ "endpoint", "device" ] property = "device.name" value = "alsa_card.usb-Focusrite_Scarlett_2i2" templates = [ "Scarlett 2i2" ] ``` -------------------------------- ### Define Keybindings and UI Actions (TOML) Source: https://context7.com/tsowell/wiremix/llms.txt Configures keyboard shortcuts and UI actions using TOML. This allows users to map keys and key combinations to various functions like navigation, volume control, device management, and application commands. Supports standard keys, special keys, media keys, and modifier keys. ```toml # Available actions in wiremix configuration # Navigation actions keybindings = [ { key = { Char = "j" }, action = "MoveDown" }, { key = { Char = "k" }, action = "MoveUp" }, { key = { Char = "H" }, action = "TabLeft" }, { key = { Char = "L" }, action = "TabRight" }, { key = { F = 1 }, action = { SelectTab = 0 } }, # Select first tab ] # Volume control actions keybindings = [ { key = "Right", action = { SetRelativeVolume = 0.01 } }, # Increase 1% { key = "Left", action = { SetRelativeVolume = -0.01 } }, # Decrease 1% { key = { Char = "+" }, action = { SetRelativeVolume = 0.05 } }, # Increase 5% { key = { Char = "-" }, action = { SetRelativeVolume = -0.05 } }, # Decrease 5% { key = { Char = "0" }, action = { SetAbsoluteVolume = 1.00 } }, # Set to 100% { key = { Char = "5" }, action = { SetAbsoluteVolume = 0.50 } }, # Set to 50% { key = { Char = "`" }, action = { SetAbsoluteVolume = 0.00 } }, # Set to 0% ] # Device control actions keybindings = [ { key = { Char = "m" }, action = "ToggleMute" }, { key = { Char = "d" }, action = "SetDefault" }, { key = { Char = "c" }, action = "ActivateDropdown" }, { key = "Esc", action = "CloseDropdown" }, ] # Application actions keybindings = [ { key = { Char = "?" }, action = "Help" }, { key = { Char = "q" }, action = "Exit" }, { key = { Char = "x" }, action = "Nothing" }, # Disable a default binding ] # Modifier key example keybindings = [ { key = "End", modifiers = "CTRL | ALT", action = "Exit" }, ] # Media keys support keybindings = [ { key = { Media = "MuteVolume" }, action = "ToggleMute" }, { key = { Media = "RaiseVolume" }, action = { SetRelativeVolume = 0.05 } }, { key = { Media = "LowerVolume" }, action = { SetRelativeVolume = -0.05 } }, ] ``` -------------------------------- ### Command-Line Interface Source: https://context7.com/tsowell/wiremix/llms.txt Wiremix can be launched with various command-line arguments to customize its behavior, such as specifying configuration files, connecting to specific PipeWire remotes, limiting framerate, and controlling UI elements. ```APIDOC ## Command-Line Interface Wiremix provides a flexible command-line interface for launching and configuring the TUI audio mixer. ### Usage ```bash wiremix [OPTIONS] ``` ### Options - `--config `: Use a custom configuration file. - `--remote `: Connect to a specific PipeWire remote (e.g., `pipewire-0`). - `--fps `: Set the framerate limit (e.g., `60`). - `--tab `: Start with a specific tab view (e.g., `playback`, `recording`, `output`, `input`, `configuration`). - `--no-mouse`: Disable mouse support. - `--char-set `: Use a specific character set for rendering (e.g., `compat`). - `--theme `: Apply a custom theme (e.g., `nocolor`). - `--max-volume-percent `: Set the maximum allowed volume percentage. - `--version`: Show the wiremix version information. ### Examples ```bash # Basic usage wiremix # Use custom config and set tab wiremix --config ~/.config/wiremix/custom.toml --tab playback # Connect to specific remote and disable mouse wiremix --remote pipewire-0 --no-mouse ``` ``` -------------------------------- ### wiremix Command-line Options Source: https://github.com/tsowell/wiremix/blob/main/README.md Displays the available command-line options for the wiremix TUI audio mixer. These options allow customization of configuration file paths, remote connections, display settings like FPS and character set, theming, peak meter display, mouse support, initial tab view, and volume limits. ```text PipeWire mixer Usage: wiremix [OPTIONS] Options: -c, --config Override default config file path -r, --remote The name of the remote to connect to -f, --fps Target frames per second (or 0 for unlimited) -s, --char-set Character set to use [built-in sets: default, compat, extracompat] -t, --theme Theme to use [built-in themes: default, nocolor, plain] -p, --peaks Audio peak meters [possible values: off, mono, auto] --no-mouse Disable mouse support --mouse Enable mouse support -v, --tab Initial tab view [possible values: playback, recording, output, input, configuration] -m, --max-volume-percent Maximum volume for volume sliders --no-enforce-max-volume Allow increasing volume past max-volume-percent --enforce-max-volume Prevent increasing volume past max-volume-percent -h, --help Print help -V, --version Print version ``` -------------------------------- ### wiremix TOML Configuration File Structure Source: https://context7.com/tsowell/wiremix/llms.txt Illustrates the structure and available options for wiremix's TOML configuration files, covering general settings, keybindings, name templates, themes, and character sets. ```toml # Basic mixer options remote = "pipewire-0" fps = 60.0 mouse = true peaks = "auto" # Options: "off", "mono", "auto" char_set = "default" theme = "default" tab = "playback" # Options: "playback", "recording", "output", "input", "configuration" max_volume_percent = 150.0 enforce_max_volume = false # Custom keybinding example keybindings = [ { key = { Char = "q" }, action = "Exit" }, { key = { Char = "m" }, action = "ToggleMute" }, { key = { Char = "d" }, action = "SetDefault" }, { key = { Char = "l" }, action = { SetRelativeVolume = 0.01 } }, { key = { Char = "h" }, action = { SetRelativeVolume = -0.01 } }, { key = { F = 1 }, action = { SelectTab = 0 } }, { key = "Enter", action = "ActivateDropdown" }, { key = "Esc", action = "CloseDropdown" }, { key = { Char = "5" }, action = { SetAbsoluteVolume = 0.50 } }, ] # Name templates for audio objects [names] stream = [ "{node:node.name}: {node:media.name}" ] endpoint = [ "{device:device.nick}", "{node:node.description}" ] device = [ "{device:device.nick}", "{device:device.description}" ] # Override names for specific applications [[names.overrides]] types = [ "stream" ] property = "node:node.name" value = "spotify" templates = [ "{node:node.name}" ] # Custom theme definition [themes.default] selector = { fg = "LightCyan" } tab_selected = { fg = "LightCyan" } volume_filled = { fg = "LightBlue" } meter_active = { fg = "LightGreen" } meter_overload = { fg = "Red" } dropdown_selected = { fg = "LightCyan", add_modifier = "REVERSED" } # Custom character set [char_sets.default] default_device = "◇" selector_middle = "▒" volume_filled = "━" volume_empty = "╌" meter_right_active = "▮" dropdown_icon = "▼" ``` -------------------------------- ### Customize Interface Themes (TOML) Source: https://context7.com/tsowell/wiremix/llms.txt Allows for the creation and customization of visual themes for the interface. Themes can be defined from scratch or inherit properties from existing themes (like 'nocolor'). Supports defining foreground/background colors, text modifiers, and specific element styles. Colors can be named or use hex codes, and modifiers include bold, italic, blink, etc. ```toml # Create a custom theme based on the default theme [themes.my_theme] selector = { fg = "#00FF00", add_modifier = "BOLD" } tab_selected = { fg = "Yellow", bg = "Blue" } volume_filled = { fg = "#3498DB" } meter_active = { fg = "Green" } meter_overload = { fg = "Red", add_modifier = "BOLD | BLINK" } dropdown_selected = { fg = "White", bg = "Black", add_modifier = "REVERSED" } # Create a high-contrast theme inheriting from nocolor [themes.high_contrast] inherit = "nocolor" selector = { add_modifier = "BOLD | UNDERLINED" } volume_filled = { add_modifier = "BOLD | REVERSED" } # Supported colors: Black, Red, Green, Yellow, Blue, Magenta, Cyan, Gray, # DarkGray, LightRed, LightGreen, LightYellow, LightBlue, LightMagenta, # LightCyan, White, or RGB hex values like "#FF5733" # Supported modifiers: BOLD, DIM, ITALIC, UNDERLINED, SLOW_BLINK, # RAPID_BLINK, REVERSED, HIDDEN, CROSSED_OUT ``` -------------------------------- ### wiremix Default Keyboard Bindings Source: https://github.com/tsowell/wiremix/blob/main/README.md Lists the default keyboard shortcuts for operating the wiremix TUI audio mixer. These bindings cover navigation, volume control, muting, device routing, tab switching, and accessing help. ```text Input | Action | | ------------- | ----------------------- | | q | Quit | | m | Toggle mute | | d | Set default source/sink | | l/Right arrow | Increment volume | | h/Left arrow | Decrement volume | | Enter/c | Open dropdown or choose | | Esc | Cancel dropdown | | j/Down arrow | Move down | | k/Up arrow | Move up | | H/Shift+Tab | Select previous tab | | L/Tab | Select next tab | | ` (Backtick) | Set volume 0% | | 1 | Set volume 10% | | 2 | Set volume 20% | | 3 | Set volume 30% | | 4 | Set volume 40% | | 5 | Set volume 50% | | 6 | Set volume 60% | | 7 | Set volume 70% | | 8 | Set volume 80% | | 9 | Set volume 90% | | 0 | Set volume 100% | | ? | Toggle help screen | ``` -------------------------------- ### Control Audio Objects with CommandSender (Rust) Source: https://context7.com/tsowell/wiremix/llms.txt Demonstrates how to use the CommandSender trait in Rust to control audio nodes and devices. This includes muting, setting volumes, switching device profiles, and setting default audio sinks. It requires a type that implements the CommandSender trait and valid ObjectId values. ```rust use wiremix::wirehose::{CommandSender, ObjectId}; fn control_audio_node( sender: &T, node_id: ObjectId, ) { // Mute a node sender.node_mute(node_id, true); // Set node volumes (stereo example: 50% left, 75% right) sender.node_volumes(node_id, vec![0.5, 0.75]); // Unmute the node sender.node_mute(node_id, false); } fn control_audio_device( sender: &T, device_id: ObjectId, ) { // Switch device profile (profile index 1) sender.device_set_profile(device_id, 1); // Set device route (route_index=0, route_device=2) sender.device_set_route(device_id, 0, 2); // Adjust device volume (route_index=0, route_device=1, volume=60%) sender.device_volumes(device_id, 0, 1, vec![0.6, 0.6]); // Mute device route sender.device_mute(device_id, 0, 1, true); } fn set_default_sink( sender: &T, metadata_id: ObjectId, sink_node_id: u32, ) { // Set default audio sink via metadata sender.metadata_set_property( metadata_id, sink_node_id, "default.audio.sink".to_string(), Some("Spa:String:JSON".to_string()), Some(format!("{{\"name\":\"{}\"}}", sink_node_id)), ); } ``` -------------------------------- ### Configure Peak Meter Visualization (TOML & Rust) Source: https://context7.com/tsowell/wiremix/llms.txt Defines how audio level peak meters are displayed. Supports disabling meters entirely, showing mono meters for all streams, or automatically selecting stereo meters for stereo streams and mono for others. Configuration can be done in TOML or parsed into a Rust enum. ```toml # Disable peak meters completely peaks = "off" # Show mono meters for all streams peaks = "mono" # Automatically show stereo meters for stereo streams, mono for others peaks = "auto" ``` ```rust use wiremix::config::Peaks; // In Rust code let peaks_config = match user_preference { "off" => Peaks::Off, "mono" => Peaks::Mono, _ => Peaks::Auto, }; ``` -------------------------------- ### Configuration File Structure Source: https://context7.com/tsowell/wiremix/llms.txt Wiremix uses TOML files for configuration, allowing customization of various aspects including PipeWire connection, UI settings, keybindings, name templates for audio objects, themes, and character sets. ```APIDOC ## Configuration File Structure Wiremix supports detailed configuration through TOML files, enabling users to customize application behavior, appearance, and controls. ### Top-Level Options - `remote` (string): The PipeWire remote to connect to. Defaults to `"pipewire-0"`. - `fps` (float): The target framerate for the UI. Defaults to `60.0`. - `mouse` (bool): Enable or disable mouse support. Defaults to `true`. - `peaks` (string): Controls audio level meter behavior. Options: `"off"`, `"mono"`, `"auto"`. Defaults to `"auto"`. - `char_set` (string): The character set to use for rendering. Defaults to `"default"`. - `theme` (string): The theme to apply to the UI. Defaults to `"default"`. - `tab` (string): The default tab to display on startup. Options: `"playback"`, `"recording"`, `"output"`, `"input"`, `"configuration"`. Defaults to `"playback"`. - `max_volume_percent` (float): The maximum volume percentage allowed. Defaults to `150.0`. - `enforce_max_volume` (bool): Whether to strictly enforce `max_volume_percent`. Defaults to `false`. ### Keybindings Customizable keybindings can be defined using a `keybindings` array. Each binding specifies a `key` (e.g., `{ Char = "q" }`, `{ F = 1 }`, `"Enter"`) and an `action` (e.g., `"Exit"`, `{ SetRelativeVolume = 0.01 }`). ```toml keybindings = [ { key = { Char = "q" }, action = "Exit" }, { key = { Char = "m" }, action = "ToggleMute" }, { key = { F = 1 }, action = { SelectTab = 0 } }, { key = { Char = "5" }, action = { SetAbsoluteVolume = 0.50 } }, ] ``` ### Name Templates Customize how audio streams, endpoints, and devices are named using templates in the `names` section. You can also define `overrides` for specific applications or properties. ```toml [names] stream = [ "{node:node.name}: {node:media.name}" ] [[names.overrides]] property = "node:node.name" value = "spotify" templates = [ "{node:node.name}" ] ``` ### Themes Define custom themes by specifying colors and modifiers for various UI elements in the `themes` section. ```toml [themes.default] selector = { fg = "LightCyan" } volume_filled = { fg = "LightBlue" } ``` ### Character Sets Define custom character sets for UI elements in the `char_sets` section. ```toml [char_sets.default] volume_filled = "━" ``` ``` -------------------------------- ### Name Template Fallback Chain Configuration Source: https://context7.com/tsowell/wiremix/llms.txt Illustrates setting up a fallback chain for stream name templates. Wiremix will try each template in the list until one successfully resolves using available PipeWire properties. ```toml [names] stream = [ "{client:application.name} - {node:media.name}", "{node:node.name}: {node:media.name}", "{node:node.name}" ] ``` -------------------------------- ### Rust Library Usage Source: https://context7.com/tsowell/wiremix/llms.txt Integrate wiremix components into your Rust applications for advanced PipeWire audio control. This includes initializing the PipeWire session, handling events, and running the application's main loop. ```APIDOC ## Rust Library Usage Wiremix can be used as a library within Rust projects to programmatically control PipeWire audio. ### Core Components - `wiremix::config::Config`: Handles configuration loading and parsing. - `wiremix::opt::Opt`: Parses command-line options. - `wiremix::wirehose::Session`: Manages the PipeWire communication session. - `wiremix::event::Event`: Represents events from PipeWire and user input. - `wiremix::app::App`: The main application struct orchestrating the TUI. ### Basic Integration Example ```rust use wiremix::config::Config; use wiremix::opt::Opt; use wiremix::wirehose::Session; use wiremix::event::Event; use wiremix::app::App; use std::sync::{mpsc, Arc}; use anyhow::Result; fn main() -> Result<()> { // Event channel setup let (event_tx, event_rx) = mpsc::channel(); let event_tx = Arc::new(event_tx); // Parse command-line options let opt = Opt::parse(); // Load configuration let config_path = opt.config.as_deref() .or(Config::default_path().as_deref()); let config = Config::try_new(config_path, &opt)?; // PipeWire event handler let event_handler = { let event_tx = Arc::clone(&event_tx); move |event| event_tx.send(Event::Pipewire(event)).is_ok() }; // Spawn PipeWire session let client = Session::spawn(config.remote.clone(), event_handler)?; // Initialize terminal and run the app let mut terminal = ratatui::init(); terminal.clear()?; let app_result = App::new(&client, event_rx, config).run(&mut terminal); // Restore terminal ratatui::restore(); app_result } ``` ``` -------------------------------- ### Fancy Unicode Character Set Configuration Source: https://context7.com/tsowell/wiremix/llms.txt Defines a character set using Unicode characters for a more visually appealing terminal interface. This set inherits from a default and overrides specific elements with Unicode symbols for devices, selectors, volume, and meters. ```toml [char_sets.fancy] inherit = "default" default_device = "♦" selector_middle = "█" volume_filled = "▰" volume_empty = "▱" meter_right_active = "▮" dropdown_icon = "▾" ``` -------------------------------- ### Literal Curly Braces in Name Templates Source: https://context7.com/tsowell/wiremix/llms.txt Demonstrates how to include literal curly braces `{` and `}` within name templates by doubling them. This is useful when the template string itself needs to contain curly braces as part of the displayed name. ```toml [names] stream = [ "Application {{name}}: {node:node.name}" ] ``` -------------------------------- ### Default Name Template Configuration Source: https://context7.com/tsowell/wiremix/llms.txt Configures default naming templates for different audio object types (stream, endpoint, device). These templates use PipeWire properties to dynamically generate display names. Multiple templates can be provided for a fallback chain. ```toml [names] stream = [ "{node:node.name}: {node:media.name}" ] endpoint = [ "{device:device.nick}", "{node:node.description}" ] device = [ "{device:device.nick}", "{device:device.description}" ] ``` -------------------------------- ### ASCII-Only Character Set Configuration Source: https://context7.com/tsowell/wiremix/llms.txt Defines a character set using only ASCII characters for maximum terminal compatibility. This is useful for environments where extended character support might be limited. It specifies various display elements like selectors, tab markers, volume indicators, and icons. ```toml [char_sets.ascii_only] default_device = "*" default_stream = "*" selector_top = "-" selector_middle = "=" selector_bottom = "-" tab_marker_left = "[" tab_marker_right = "]" list_more = "..." volume_empty = "-" volume_filled = "=" meter_right_active = "#" meter_right_inactive = "-" meter_right_overload = "!" dropdown_icon = "v" dropdown_selector = ">" dropdown_more = "..." dropdown_border = "Plain" help_border = "Plain" ``` -------------------------------- ### Configure mpv Naming Override Source: https://github.com/tsowell/wiremix/blob/main/README.md This TOML configuration snippet overrides the default naming convention for 'stream' types in Wiremix when dealing with mpv. It targets the 'node:node.name' property and replaces the default 'mpv' value with a template that uses '{node:media.name}', resulting in cleaner display names. ```toml [[names.overrides]] types = [ "stream" ] property = "node:node.name" value = "mpv" templates = [ "{node:media.name}" ] ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.