feat(bar): use phosphor icons for uniformity

This commit is contained in:
LGUG2Z
2024-09-08 12:38:51 -07:00
parent 9f78739c3f
commit a4ef85859e
10 changed files with 53 additions and 29 deletions
Generated
+10
View File
@@ -1406,6 +1406,15 @@ dependencies = [
"serde", "serde",
] ]
[[package]]
name = "egui-phosphor"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7198d3a35fbe756a3daa10a98942159f70dce10d5f2f9ccdb11d242d3bf2fa47"
dependencies = [
"egui",
]
[[package]] [[package]]
name = "egui-wgpu" name = "egui-wgpu"
version = "0.28.1" version = "0.28.1"
@@ -2657,6 +2666,7 @@ dependencies = [
"chrono", "chrono",
"crossbeam-channel", "crossbeam-channel",
"eframe", "eframe",
"egui-phosphor",
"font-loader", "font-loader",
"image", "image",
"komorebi-client", "komorebi-client",
+1
View File
@@ -21,3 +21,4 @@ starship-battery = "0.10"
sysinfo = "0.31" sysinfo = "0.31"
windows = { workspace = true } windows = { workspace = true }
windows-icons = "0.1" windows-icons = "0.1"
egui-phosphor = "0.6.0"
+2 -2
View File
@@ -91,8 +91,8 @@ impl BarWidget for Battery {
if !output.is_empty() { if !output.is_empty() {
for battery in output { for battery in output {
let emoji = match self.state { let emoji = match self.state {
BatteryState::Charging => "⚡️", BatteryState::Charging => egui_phosphor::regular::BATTERY_CHARGING,
BatteryState::Discharging => "🔋", BatteryState::Discharging => egui_phosphor::regular::BATTERY_FULL,
}; };
ui.add( ui.add(
+7 -3
View File
@@ -67,9 +67,13 @@ impl BarWidget for Date {
for output in self.output() { for output in self.output() {
if ui if ui
.add( .add(
Label::new(format!("📅 {}", output)) Label::new(format!(
.selectable(false) "{} {}",
.sense(Sense::click()), egui_phosphor::regular::CALENDAR_DOTS,
output
))
.selectable(false)
.sense(Sense::click()),
) )
.clicked() .clicked()
{ {
+7 -11
View File
@@ -139,7 +139,7 @@ fn main() -> eframe::Result<()> {
enable: true, enable: true,
hide_empty_workspaces: true, hide_empty_workspaces: true,
}, },
layout: KomorebiLayoutConfig { enable: false }, layout: KomorebiLayoutConfig { enable: true },
focused_window: KomorebiFocusedWindowConfig { focused_window: KomorebiFocusedWindowConfig {
enable: true, enable: true,
show_icon: true, show_icon: true,
@@ -325,8 +325,9 @@ impl KomorebiNotificationState {
} }
} }
fn add_custom_font(ctx: &egui::Context, name: &str) { fn add_custom_font(ctx: &Context, name: &str) {
let mut fonts = egui::FontDefinitions::default(); let mut fonts = egui::FontDefinitions::default();
egui_phosphor::add_to_fonts(&mut fonts, egui_phosphor::Variant::Regular);
let property = FontPropertyBuilder::new().family(name).build(); let property = FontPropertyBuilder::new().family(name).build();
@@ -430,14 +431,10 @@ impl eframe::App for Komobar {
.handle_notification(self.rx_gui.clone()); .handle_notification(self.rx_gui.clone());
egui::CentralPanel::default() egui::CentralPanel::default()
.frame( .frame(egui::Frame::none().outer_margin(egui::Margin::symmetric(
egui::Frame::none() self.config.outer_margin.x,
// TODO: make this configurable self.config.outer_margin.y,
.outer_margin(egui::Margin::symmetric( )))
self.config.outer_margin.x,
self.config.outer_margin.y,
)),
)
.show(ctx, |ui| { .show(ctx, |ui| {
ui.horizontal_centered(|ui| { ui.horizontal_centered(|ui| {
ui.with_layout(Layout::left_to_right(Align::Center), |ui| { ui.with_layout(Layout::left_to_right(Align::Center), |ui| {
@@ -446,7 +443,6 @@ impl eframe::App for Komobar {
} }
}); });
// TODO: make the order configurable
ui.with_layout(Layout::right_to_left(Align::Center), |ui| { ui.with_layout(Layout::right_to_left(Align::Center), |ui| {
for w in &mut self.right_widgets { for w in &mut self.right_widgets {
w.render(ctx, ui); w.render(ctx, ui);
+1 -1
View File
@@ -70,7 +70,7 @@ impl BarWidget for Media {
for output in self.output() { for output in self.output() {
if ui if ui
.add( .add(
Label::new(format!("🎧 {output}")) Label::new(format!("{} {output}", egui_phosphor::regular::HEADPHONES))
.selectable(false) .selectable(false)
.sense(Sense::click()), .sense(Sense::click()),
) )
+1 -1
View File
@@ -55,7 +55,7 @@ impl BarWidget for Memory {
for output in self.output() { for output in self.output() {
if ui if ui
.add( .add(
Label::new(format!("🐏 {}", output)) Label::new(format!("{} {}", egui_phosphor::regular::MEMORY, output))
.selectable(false) .selectable(false)
.sense(Sense::click()), .sense(Sense::click()),
) )
+15 -6
View File
@@ -101,9 +101,13 @@ impl BarWidget for Network {
1 => { 1 => {
if ui if ui
.add( .add(
Label::new(format!("📶 {}", output[0])) Label::new(format!(
.selectable(false) "{} {}",
.sense(Sense::click()), egui_phosphor::regular::WIFI_HIGH,
output[0]
))
.selectable(false)
.sense(Sense::click()),
) )
.clicked() .clicked()
{ {
@@ -116,9 +120,14 @@ impl BarWidget for Network {
2 => { 2 => {
if ui if ui
.add( .add(
Label::new(format!("📶 {} - {}", output[0], output[1])) Label::new(format!(
.selectable(false) "{} {} - {}",
.sense(Sense::click()), egui_phosphor::regular::WIFI_HIGH,
output[0],
output[1]
))
.selectable(false)
.sense(Sense::click()),
) )
.clicked() .clicked()
{ {
+7 -3
View File
@@ -65,9 +65,13 @@ impl BarWidget for Storage {
for output in self.output() { for output in self.output() {
if ui if ui
.add( .add(
Label::new(format!("🖴 {}", output)) Label::new(format!(
.selectable(false) "{} {}",
.sense(Sense::click()), egui_phosphor::regular::HARD_DRIVES,
output
))
.selectable(false)
.sense(Sense::click()),
) )
.clicked() .clicked()
{ {
+1 -1
View File
@@ -61,7 +61,7 @@ impl BarWidget for Time {
for output in self.output() { for output in self.output() {
if ui if ui
.add( .add(
Label::new(format!("🕐 {}", output)) Label::new(format!("{} {}", egui_phosphor::regular::CLOCK, output))
.selectable(false) .selectable(false)
.sense(Sense::click()), .sense(Sense::click()),
) )