Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,10 @@ WirePlumber start in that user's session. Inspect pairing logs with

### Terminal control panel and talk groups

Start the Ratatui control panel after saving a headset network:
Start the terminal control panel after saving a headset network:

```sh
bt-intercom tui
bt-intercom panel
```

The panel shows Bluetooth connection and signal status plus PipeWire duplex
Expand Down
2 changes: 1 addition & 1 deletion docs/demo.cast
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
[0.0,"o","--he"]
[0.12,"i","lp\r"]
[0.0,"o","lp\r\n"]
[0.25,"o","A Bluetooth headset intercom for Linux\r\n\r\nUsage: bt-intercom [OPTIONS] <COMMAND>\r\n\r\nCommands:\r\n scan Scan for nearby Bluetooth devices\r\n pair Pair, trust, and connect a headset\r\n remove Remove a headset from the saved intercom network\r\n status Show Bluetooth headset audio status\r\n run Route configured headset microphones to one another\r\n completions Generate shell completion definitions\r\n tui Open the terminal headset and talk-group control panel\r\n help Print this message or the help of the given subcommand(s)\r\n\r\nOptions:\r\n --verbose Enable detailed diagnostics on stderr (unless RUST_LOG is set)\r\n -V, --version \r\n -h, --help Print help\r\n"]
[0.25,"o","A Bluetooth headset intercom for Linux\r\n\r\nUsage: bt-intercom [OPTIONS] <COMMAND>\r\n\r\nCommands:\r\n scan Scan for nearby Bluetooth devices\r\n pair Pair, trust, and connect a headset\r\n remove Remove a headset from the saved intercom network\r\n status Show Bluetooth headset audio status\r\n run Route configured headset microphones to one another\r\n completions Generate shell completion definitions\r\n panel Open the interactive terminal control panel\r\n help Print this message or the help of the given subcommand(s)\r\n\r\nOptions:\r\n --verbose Enable detailed diagnostics on stderr (unless RUST_LOG is set)\r\n -V, --version \r\n -h, --help Print help\r\n"]
[0.5,"o","$ "]
[0.12,"i","bt-i"]
[0.0,"o","bt-i"]
Expand Down
4 changes: 2 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ <h3>Hear only your group.</h3>
<div class="panel-copy">
<p class="eyebrow">A small terminal, a clear picture</p>
<h2 id="panel-title">Keep the network in hand.</h2>
<p>Open <code>bt-intercom tui</code> for the terminal control panel. Check Bluetooth connection and signal, confirm duplex audio is available, then manage groups and membership without editing config files.</p>
<p>Open <code>bt-intercom panel</code> for the terminal control panel. Check Bluetooth connection and signal, confirm duplex audio is available, then manage groups and membership without editing config files.</p>
<ul class="key-list">
<li><kbd>Tab</kbd><span>Switch between groups and headsets</span></li>
<li><kbd>↑ ↓</kbd><span>Select a group or member</span></li>
Expand Down Expand Up @@ -138,7 +138,7 @@ <h2 id="panel-title">Keep the network in hand.</h2>
</div>
<div class="tui-footer">Tab switch pane | ↑/↓ select | n add | d delete | Space toggle member | q quit</div>
</div>
<p class="tui-caption">Illustrative terminal view; the TUI runs in your terminal, not in a separate app window.</p>
<p class="tui-caption">Illustrative terminal view; the control panel runs in your terminal, not in a separate app window.</p>
</div>
</section>

Expand Down
4 changes: 2 additions & 2 deletions man/bt-intercom.1
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ With --pair-button, a missing saved network starts empty for headless enrollment
Write shell completion definitions to standard output. Supported shells include
Bash, Zsh, Fish, and Elvish.
.TP
.B tui
Open the Ratatui terminal control panel to monitor headsets and edit talk
.B panel
Open the interactive terminal control panel to monitor headsets and edit talk
groups. Use Tab and arrow keys to navigate; press n to add a group, d to remove
the selected group, and Space to toggle headset membership.
.SH OPTIONS
Expand Down
17 changes: 14 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ enum CliCommand {
#[arg(value_enum)]
shell: Shell,
},
/// Open the terminal headset and talk-group control panel.
Tui,
/// Open the interactive terminal control panel.
Panel,
}

/// Opens an interactive BlueZ agent session to pair the specified device.
Expand Down Expand Up @@ -562,7 +562,7 @@ fn reconnect_worker(
/// Executes one CLI action, including the main polling and routing loop.
fn run(action: CliCommand) -> Result<(), String> {
match action {
CliCommand::Tui => {
CliCommand::Panel => {
let network_path = headset_network_path()?;
let allowed = load_headsets(&network_path)?;
tui::run(allowed, talk_groups_path(&network_path)?)?;
Expand Down Expand Up @@ -1162,6 +1162,17 @@ mod tests {
}
}

#[test]
fn terminal_control_panel_uses_panel_subcommand() {
assert!(matches!(
Cli::try_parse_from(["bt-intercom", "panel"])
.unwrap()
.command,
CliCommand::Panel
));
assert!(Cli::try_parse_from(["bt-intercom", "tui"]).is_err());
}

#[test]
fn verbose_is_global_and_version_short_alias_is_preserved() {
for args in [
Expand Down
2 changes: 1 addition & 1 deletion src/tui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ impl Drop for TerminalRestore {

pub fn run(allowed: BTreeSet<String>, groups_path: PathBuf) -> Result<(), String> {
if !std::io::stdin().is_terminal() || !std::io::stdout().is_terminal() {
return Err("the TUI requires an interactive terminal".into());
return Err("the control panel requires an interactive terminal".into());
}
let mut app = ControlPanel::new(allowed, groups_path)?;
let mut terminal = ratatui::try_init().map_err(|error| error.to_string())?;
Expand Down