diff --git a/src/app.rs b/src/app.rs index ebd0a16..0d7fe15 100644 --- a/src/app.rs +++ b/src/app.rs @@ -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 { @@ -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(); diff --git a/src/config.rs b/src/config.rs index 3041a62..02ab3f5 100644 --- a/src/config.rs +++ b/src/config.rs @@ -26,6 +26,9 @@ pub struct Config { #[serde(default)] pub paired_device: PairedDevice, + + #[serde(default = "default_true")] + pub fonts: bool, } #[derive(Debug, Default)] @@ -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) -> Self { let conf_path = config_file_path.unwrap_or( diff --git a/src/help.rs b/src/help.rs index bdef3b9..8e70ff3 100644 --- a/src/help.rs +++ b/src/help.rs @@ -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(), 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("󱁐 or ↵ ").bold(), + Span::from(format!("{}↵ ", if config.fonts { "󱁐 or " } else { "" })) + .bold(), Span::from(" Dis/Connect"), Span::from(" | "), Span::from("s").bold(),