Skip to content
Open
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
62 changes: 50 additions & 12 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -416,41 +416,75 @@ impl App {
.iter()
.map(|d| {
Row::new(vec![
format!("{} {}", &d.icon, &d.alias),
format!(
"{} {}",
if self.config.fonts { &d.icon } else { "" },
&d.alias
),
d.is_trusted.to_string(),
d.is_connected.to_string(),
{
if let Some(battery_percentage) = d.battery_percentage {
match battery_percentage {
n if n >= 90 => {
format!("{battery_percentage}% 󰥈 ")
format!(
"{battery_percentage}% {}",
if self.config.fonts { "󰥈" } else { "" }
)
}
n if (80..90).contains(&n) => {
format!("{battery_percentage}% 󰥅 ")
format!(
"{battery_percentage}% {}",
if self.config.fonts { "󰥅" } else { "" }
)
}
n if (70..80).contains(&n) => {
format!("{battery_percentage}% 󰥄 ")
format!(
"{battery_percentage}% {}",
if self.config.fonts { "󰥄" } else { "" }
)
}
n if (60..70).contains(&n) => {
format!("{battery_percentage}% 󰥃 ")
format!(
"{battery_percentage}% {}",
if self.config.fonts { "󰥃" } else { "" }
)
}
n if (50..60).contains(&n) => {
format!("{battery_percentage}% 󰥂 ")
format!(
"{battery_percentage}% {}",
if self.config.fonts { "󰥂" } else { "" }
)
}
n if (40..50).contains(&n) => {
format!("{battery_percentage}% 󰥁 ")
format!(
"{battery_percentage}% {}",
if self.config.fonts { "󰥁" } else { "" }
)
}
n if (30..40).contains(&n) => {
format!("{battery_percentage}% 󰥀 ")
format!(
"{battery_percentage}% {}",
if self.config.fonts { "󰥀" } else { "" }
)
}
n if (20..30).contains(&n) => {
format!("{battery_percentage}% 󰤿 ")
format!(
"{battery_percentage}% {}",
if self.config.fonts { "󰤿" } else { "" }
)
}
n if (10..20).contains(&n) => {
format!("{battery_percentage}% 󰤾 ")
format!(
"{battery_percentage}% {}",
if self.config.fonts { "󰤾" } else { "" }
)
}
_ => {
format!("{battery_percentage}% 󰤾 ")
format!(
"{battery_percentage}% {}",
if self.config.fonts { "󰤾" } else { "" }
)
}
}
} else {
Expand Down Expand Up @@ -587,7 +621,11 @@ impl App {
.map(|d| {
Row::new(vec![
d.addr.to_string(),
format!("{} {}", &d.icon, &d.alias),
format!(
"{} {}",
if self.config.fonts { &d.icon } else { "" },
&d.alias
),
])
})
.collect();
Expand Down
7 changes: 7 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ pub struct Config {

#[serde(default)]
pub paired_device: PairedDevice,

#[serde(default = "default_true")]
pub fonts: bool,
}

#[derive(Debug, Default)]
Expand Down Expand Up @@ -186,6 +189,10 @@ fn default_toggle_device_trust() -> char {
't'
}

fn default_true() -> bool {
true
}

impl Config {
pub fn new(config_file_path: Option<PathBuf>) -> Self {
let conf_path = config_file_path.unwrap_or(
Expand Down
6 changes: 4 additions & 2 deletions src/help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ impl Help {
Span::from(config.paired_device.unpair.to_string()).bold(),
Span::from(" Unpair"),
Span::from(" | "),
Span::from("󱁐 or ↵ ").bold(),
Span::from(format!("{}↵ ", if config.fonts { "󱁐 or " } else { "" }))
.bold(),
Comment on lines +39 to +40
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can not just remove it. Maybe you can add the name of the key instead, like space or enter. but then you will need to take that change into account to make the help banner responsive.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not removed entirely. You can still see what is. Only the weird character was removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2025-11-13-210628_503x162_scrot

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I built it, ran it, and I can't find anything that looks wrong. That said, it's difficult without knowing what "right" would've looked like :-)

Span::from(" Dis/Connect"),
Span::from(" | "),
Span::from(config.paired_device.toggle_trust.to_string()).bold(),
Expand All @@ -51,7 +52,8 @@ impl Help {
} else {
vec![
Line::from(vec![
Span::from("󱁐 or ↵ ").bold(),
Span::from(format!("{}↵ ", if config.fonts { "󱁐 or " } else { "" }))
.bold(),
Comment on lines +55 to +56
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Span::from(" Dis/Connect"),
Span::from(" | "),
Span::from("s").bold(),
Expand Down