WIP: improve Linux audio support
This commit is contained in:
@@ -135,7 +135,12 @@ fn render_settings_section(frame: &mut Frame, app: &App, area: Rect) {
|
||||
let down_indicator = Paragraph::new("▼").style(indicator_style);
|
||||
frame.render_widget(
|
||||
down_indicator,
|
||||
Rect::new(indicator_x, padded.y + padded.height.saturating_sub(1), 1, 1),
|
||||
Rect::new(
|
||||
indicator_x,
|
||||
padded.y + padded.height.saturating_sub(1),
|
||||
1,
|
||||
1,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -211,9 +216,13 @@ fn render_section_header(frame: &mut Frame, title: &str, focused: bool, area: Re
|
||||
Layout::vertical([Constraint::Length(1), Constraint::Length(1)]).areas(area);
|
||||
|
||||
let header_style = if focused {
|
||||
Style::new().fg(theme.engine.header_focused).add_modifier(Modifier::BOLD)
|
||||
Style::new()
|
||||
.fg(theme.engine.header_focused)
|
||||
.add_modifier(Modifier::BOLD)
|
||||
} else {
|
||||
Style::new().fg(theme.engine.header).add_modifier(Modifier::BOLD)
|
||||
Style::new()
|
||||
.fg(theme.engine.header)
|
||||
.add_modifier(Modifier::BOLD)
|
||||
};
|
||||
|
||||
frame.render_widget(Paragraph::new(title).style(header_style), header_area);
|
||||
@@ -292,7 +301,9 @@ fn render_device_column(
|
||||
Layout::vertical([Constraint::Length(1), Constraint::Min(1)]).areas(area);
|
||||
|
||||
let label_style = if focused {
|
||||
Style::new().fg(theme.engine.focused).add_modifier(Modifier::BOLD)
|
||||
Style::new()
|
||||
.fg(theme.engine.focused)
|
||||
.add_modifier(Modifier::BOLD)
|
||||
} else if section_focused {
|
||||
Style::new().fg(theme.engine.label_focused)
|
||||
} else {
|
||||
@@ -322,7 +333,9 @@ fn render_settings(frame: &mut Frame, app: &App, area: Rect) {
|
||||
|
||||
render_section_header(frame, "SETTINGS", section_focused, header_area);
|
||||
|
||||
let highlight = Style::new().fg(theme.engine.focused).add_modifier(Modifier::BOLD);
|
||||
let highlight = Style::new()
|
||||
.fg(theme.engine.focused)
|
||||
.add_modifier(Modifier::BOLD);
|
||||
let normal = Style::new().fg(theme.engine.normal);
|
||||
let label_style = Style::new().fg(theme.engine.label);
|
||||
let value_style = Style::new().fg(theme.engine.value);
|
||||
@@ -373,7 +386,11 @@ fn render_settings(frame: &mut Frame, app: &App, area: Rect) {
|
||||
label_style,
|
||||
),
|
||||
render_selector(
|
||||
&format!("{}", app.audio.config.buffer_size),
|
||||
&if app.audio.config.host_name.to_lowercase().contains("jack") {
|
||||
"JACK managed".to_string()
|
||||
} else {
|
||||
format!("{}", app.audio.config.buffer_size)
|
||||
},
|
||||
buffer_focused,
|
||||
highlight,
|
||||
normal,
|
||||
@@ -420,6 +437,17 @@ fn render_settings(frame: &mut Frame, app: &App, area: Rect) {
|
||||
value_style,
|
||||
),
|
||||
]),
|
||||
Row::new(vec![
|
||||
Span::styled(" Audio host", label_style),
|
||||
Span::styled(
|
||||
if app.audio.config.host_name.is_empty() {
|
||||
"-".to_string()
|
||||
} else {
|
||||
app.audio.config.host_name.clone()
|
||||
},
|
||||
value_style,
|
||||
),
|
||||
]),
|
||||
];
|
||||
|
||||
let table = Table::new(rows, [Constraint::Length(14), Constraint::Fill(1)]);
|
||||
|
||||
Reference in New Issue
Block a user