From b38f94dfcb9be5562bdaa7895919c23a20254194 Mon Sep 17 00:00:00 2001 From: Cake Duke Date: Wed, 12 Nov 2025 17:37:01 +0000 Subject: [PATCH 1/6] Remove unusual fonts --- src/app.rs | 30 +++++++++++++++--------------- src/config.rs | 3 +++ 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/app.rs b/src/app.rs index 5972ed7..c89cd26 100644 --- a/src/app.rs +++ b/src/app.rs @@ -403,7 +403,7 @@ impl App { Row::new(vec![ { if let Some(icon) = &d.icon { - format!("{} {}", icon, &d.alias) + format!("{} {}", if self.config.fonts {icon} else {""}, &d.alias) } else { d.alias.to_owned() } @@ -414,34 +414,34 @@ impl App { 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 { @@ -579,7 +579,7 @@ impl App { .map(|d| { Row::new(vec![d.addr.to_string(), { if let Some(icon) = &d.icon { - format!("{} {}", icon, &d.alias) + format!("{} {}", if self.config.fonts {icon} else {""}, &d.alias) } else { if d.alias.len() > max_name_width { max_name_width = d.alias.len(); @@ -691,7 +691,7 @@ impl App { Span::from(self.config.paired_device.unpair.to_string()).bold(), Span::from(" Unpair"), Span::from(" | "), - Span::from("󱁐 or ↵ ").bold(), + Span::from(if self.config.fonts {"󱁐 or ↵ "} else {" ↵ "}).bold(), Span::from(" Dis/Connect"), Span::from(" | "), Span::from(self.config.paired_device.toggle_trust.to_string()).bold(), @@ -706,7 +706,7 @@ impl App { } else { vec![ Line::from(vec![ - Span::from("󱁐 or ↵ ").bold(), + Span::from(if self.config.fonts {"󱁐 or ↵ "} else {" ↵ "}).bold(), Span::from(" Dis/Connect"), Span::from(" | "), Span::from("s").bold(), @@ -742,7 +742,7 @@ impl App { Span::from("j,").bold(), Span::from(" Down"), Span::from(" | "), - Span::from("󱁐 or ↵ ").bold(), + Span::from(if self.config.fonts {"󱁐 or ↵ "} else {" ↵ "}).bold(), Span::from(" Pair"), Span::from(" | "), Span::from("s").bold(), diff --git a/src/config.rs b/src/config.rs index 3041a62..69baeaf 100644 --- a/src/config.rs +++ b/src/config.rs @@ -26,6 +26,9 @@ pub struct Config { #[serde(default)] pub paired_device: PairedDevice, + + #[serde(default)] + pub fonts: bool, } #[derive(Debug, Default)] From 776b025684970b69b7d4e5aca7749372128c2d7e Mon Sep 17 00:00:00 2001 From: Cake Duke Date: Thu, 13 Nov 2025 20:13:44 +0000 Subject: [PATCH 2/6] Make config.fonts default true --- src/config.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/config.rs b/src/config.rs index 69baeaf..02ab3f5 100644 --- a/src/config.rs +++ b/src/config.rs @@ -27,7 +27,7 @@ pub struct Config { #[serde(default)] pub paired_device: PairedDevice, - #[serde(default)] + #[serde(default = "default_true")] pub fonts: bool, } @@ -189,6 +189,10 @@ fn default_toggle_device_trust() -> char { 't' } +fn default_true() -> bool { + true +} + impl Config { pub fn new(config_file_path: Option) -> Self { let conf_path = config_file_path.unwrap_or( From 52e159cda8571a0aa41fe7e6aed06998104dfc51 Mon Sep 17 00:00:00 2001 From: Cake Duke Date: Thu, 13 Nov 2025 20:21:41 +0000 Subject: [PATCH 3/6] rustfmt --- src/config.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config.rs b/src/config.rs index 02ab3f5..8094bad 100644 --- a/src/config.rs +++ b/src/config.rs @@ -6,8 +6,8 @@ use toml; use dirs; use serde::{ - Deserialize, Deserializer, de::{self, Unexpected, Visitor}, + Deserialize, Deserializer, }; #[derive(Deserialize, Debug)] From aa7518c4a57d3427efd8de5e5d4f1a8458090d45 Mon Sep 17 00:00:00 2001 From: Cake Duke Date: Thu, 13 Nov 2025 20:54:51 +0000 Subject: [PATCH 4/6] Remove more unusual fonts --- src/help.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/help.rs b/src/help.rs index bdef3b9..29a82c8 100644 --- a/src/help.rs +++ b/src/help.rs @@ -36,7 +36,7 @@ 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(), Span::from(" Dis/Connect"), Span::from(" | "), Span::from(config.paired_device.toggle_trust.to_string()).bold(), @@ -51,7 +51,7 @@ impl Help { } else { vec![ Line::from(vec![ - Span::from("󱁐 or ↵ ").bold(), + Span::from(format!("{}↵ ", if config.fonts {"󱁐 or "} else {""})).bold(), Span::from(" Dis/Connect"), Span::from(" | "), Span::from("s").bold(), From e97f3f1de744a2cdd7afa793f92fbbd74c5d100a Mon Sep 17 00:00:00 2001 From: Cake Duke Date: Thu, 13 Nov 2025 20:55:21 +0000 Subject: [PATCH 5/6] rustfmt --- src/help.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/help.rs b/src/help.rs index 29a82c8..8a59655 100644 --- a/src/help.rs +++ b/src/help.rs @@ -1,11 +1,11 @@ use std::sync::Arc; use ratatui::{ - Frame, layout::Rect, style::Stylize, text::{Line, Span}, widgets::Paragraph, + Frame, }; use crate::{app::FocusedBlock, config::Config}; @@ -36,7 +36,8 @@ impl Help { Span::from(config.paired_device.unpair.to_string()).bold(), Span::from(" Unpair"), Span::from(" | "), - Span::from(format!("{}↵ ", if config.fonts {"󱁐 or "} else {""})).bold(), + Span::from(format!("{}↵ ", if config.fonts { "󱁐 or " } else { "" })) + .bold(), Span::from(" Dis/Connect"), Span::from(" | "), Span::from(config.paired_device.toggle_trust.to_string()).bold(), @@ -51,7 +52,8 @@ impl Help { } else { vec![ Line::from(vec![ - Span::from(format!("{}↵ ", if config.fonts {"󱁐 or "} else {""})).bold(), + Span::from(format!("{}↵ ", if config.fonts { "󱁐 or " } else { "" })) + .bold(), Span::from(" Dis/Connect"), Span::from(" | "), Span::from("s").bold(), From c5c82e83ef6113054722c8614b415c3d107069d9 Mon Sep 17 00:00:00 2001 From: Cake Duke Date: Thu, 13 Nov 2025 21:00:01 +0000 Subject: [PATCH 6/6] linting --- src/app.rs | 62 +++++++++++++++++++++++++++++++++++++++++---------- src/config.rs | 2 +- src/help.rs | 2 +- 3 files changed, 52 insertions(+), 14 deletions(-) diff --git a/src/app.rs b/src/app.rs index c3fd231..0d7fe15 100644 --- a/src/app.rs +++ b/src/app.rs @@ -416,41 +416,75 @@ impl App { .iter() .map(|d| { Row::new(vec![ - format!("{} {}", if self.config.fonts {&d.icon} else {""}, &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}% {}", if self.config.fonts {"󰥈"} else {""}) + format!( + "{battery_percentage}% {}", + if self.config.fonts { "󰥈" } else { "" } + ) } n if (80..90).contains(&n) => { - format!("{battery_percentage}% {}", if self.config.fonts {"󰥅"} else {""}) + format!( + "{battery_percentage}% {}", + if self.config.fonts { "󰥅" } else { "" } + ) } n if (70..80).contains(&n) => { - format!("{battery_percentage}% {}", if self.config.fonts {"󰥄"} else {""}) + format!( + "{battery_percentage}% {}", + if self.config.fonts { "󰥄" } else { "" } + ) } n if (60..70).contains(&n) => { - format!("{battery_percentage}% {}", if self.config.fonts {"󰥃"} else {""}) + format!( + "{battery_percentage}% {}", + if self.config.fonts { "󰥃" } else { "" } + ) } n if (50..60).contains(&n) => { - format!("{battery_percentage}% {}", if self.config.fonts {"󰥂"} else {""}) + format!( + "{battery_percentage}% {}", + if self.config.fonts { "󰥂" } else { "" } + ) } n if (40..50).contains(&n) => { - format!("{battery_percentage}% {}", if self.config.fonts {"󰥁"} else {""}) + format!( + "{battery_percentage}% {}", + if self.config.fonts { "󰥁" } else { "" } + ) } n if (30..40).contains(&n) => { - format!("{battery_percentage}% {}", if self.config.fonts {"󰥀"} else {""}) + format!( + "{battery_percentage}% {}", + if self.config.fonts { "󰥀" } else { "" } + ) } n if (20..30).contains(&n) => { - format!("{battery_percentage}% {}", if self.config.fonts {"󰤿"} else {""}) + format!( + "{battery_percentage}% {}", + if self.config.fonts { "󰤿" } else { "" } + ) } n if (10..20).contains(&n) => { - format!("{battery_percentage}% {}", if self.config.fonts {"󰤾"} else {""}) + format!( + "{battery_percentage}% {}", + if self.config.fonts { "󰤾" } else { "" } + ) } _ => { - format!("{battery_percentage}% {}", if self.config.fonts {"󰤾"} else {""}) + format!( + "{battery_percentage}% {}", + if self.config.fonts { "󰤾" } else { "" } + ) } } } else { @@ -587,7 +621,11 @@ impl App { .map(|d| { Row::new(vec![ d.addr.to_string(), - format!("{} {}", if self.config.fonts {&d.icon} else {""}, &d.alias), + format!( + "{} {}", + if self.config.fonts { &d.icon } else { "" }, + &d.alias + ), ]) }) .collect(); diff --git a/src/config.rs b/src/config.rs index 8094bad..02ab3f5 100644 --- a/src/config.rs +++ b/src/config.rs @@ -6,8 +6,8 @@ use toml; use dirs; use serde::{ - de::{self, Unexpected, Visitor}, Deserialize, Deserializer, + de::{self, Unexpected, Visitor}, }; #[derive(Deserialize, Debug)] diff --git a/src/help.rs b/src/help.rs index 8a59655..8e70ff3 100644 --- a/src/help.rs +++ b/src/help.rs @@ -1,11 +1,11 @@ use std::sync::Arc; use ratatui::{ + Frame, layout::Rect, style::Stylize, text::{Line, Span}, widgets::Paragraph, - Frame, }; use crate::{app::FocusedBlock, config::Config};