mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-07-08 14:05:10 +02:00
renamed Side to Alignment, group spacing
This commit is contained in:
+10
-9
@@ -245,8 +245,9 @@ impl Komobar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// apply rounding to the widgets
|
// apply rounding to the widgets
|
||||||
if let Some(Grouping::Bar(config) | Grouping::Side(config) | Grouping::Widget(config)) =
|
if let Some(
|
||||||
&config.grouping
|
Grouping::Bar(config) | Grouping::Alignment(config) | Grouping::Widget(config),
|
||||||
|
) = &config.grouping
|
||||||
{
|
{
|
||||||
if let Some(rounding) = config.rounding {
|
if let Some(rounding) = config.rounding {
|
||||||
ctx.style_mut(|style| {
|
ctx.style_mut(|style| {
|
||||||
@@ -282,7 +283,7 @@ impl Komobar {
|
|||||||
if let WidgetConfig::Komorebi(config) = widget_config {
|
if let WidgetConfig::Komorebi(config) = widget_config {
|
||||||
komorebi_widget = Some(Komorebi::from(config));
|
komorebi_widget = Some(Komorebi::from(config));
|
||||||
komorebi_widget_idx = Some(idx);
|
komorebi_widget_idx = Some(idx);
|
||||||
side = Some(Side::Left);
|
side = Some(Alignment::Left);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -290,7 +291,7 @@ impl Komobar {
|
|||||||
if let WidgetConfig::Komorebi(config) = widget_config {
|
if let WidgetConfig::Komorebi(config) = widget_config {
|
||||||
komorebi_widget = Some(Komorebi::from(config));
|
komorebi_widget = Some(Komorebi::from(config));
|
||||||
komorebi_widget_idx = Some(idx);
|
komorebi_widget_idx = Some(idx);
|
||||||
side = Some(Side::Right);
|
side = Some(Alignment::Right);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -324,8 +325,8 @@ impl Komobar {
|
|||||||
|
|
||||||
let boxed: Box<dyn BarWidget> = Box::new(widget);
|
let boxed: Box<dyn BarWidget> = Box::new(widget);
|
||||||
match side {
|
match side {
|
||||||
Side::Left => left_widgets[idx] = boxed,
|
Alignment::Left => left_widgets[idx] = boxed,
|
||||||
Side::Right => right_widgets[idx] = boxed,
|
Alignment::Right => right_widgets[idx] = boxed,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -475,7 +476,7 @@ impl eframe::App for Komobar {
|
|||||||
ui.horizontal_centered(|ui| {
|
ui.horizontal_centered(|ui| {
|
||||||
// Left-aligned widgets layout
|
// Left-aligned widgets layout
|
||||||
ui.with_layout(Layout::left_to_right(Align::Center), |ui| {
|
ui.with_layout(Layout::left_to_right(Align::Center), |ui| {
|
||||||
render_config.grouping.apply_on_side(ui, |ui| {
|
render_config.grouping.apply_on_alignment(ui, |ui| {
|
||||||
for w in &mut self.left_widgets {
|
for w in &mut self.left_widgets {
|
||||||
w.render(ctx, ui, render_config_clone);
|
w.render(ctx, ui, render_config_clone);
|
||||||
}
|
}
|
||||||
@@ -484,7 +485,7 @@ impl eframe::App for Komobar {
|
|||||||
|
|
||||||
// Right-aligned widgets layout
|
// Right-aligned widgets layout
|
||||||
ui.with_layout(Layout::right_to_left(Align::Center), |ui| {
|
ui.with_layout(Layout::right_to_left(Align::Center), |ui| {
|
||||||
render_config.grouping.apply_on_side(ui, |ui| {
|
render_config.grouping.apply_on_alignment(ui, |ui| {
|
||||||
for w in &mut self.right_widgets {
|
for w in &mut self.right_widgets {
|
||||||
w.render(ctx, ui, render_config_clone);
|
w.render(ctx, ui, render_config_clone);
|
||||||
}
|
}
|
||||||
@@ -497,7 +498,7 @@ impl eframe::App for Komobar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
enum Side {
|
enum Alignment {
|
||||||
Left,
|
Left,
|
||||||
Right,
|
Right,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
use crate::config::LabelPrefix;
|
use crate::config::LabelPrefix;
|
||||||
use crate::widget::BarWidget;
|
use crate::widget::BarWidget;
|
||||||
use crate::widget::RenderConfig;
|
use crate::widget::RenderConfig;
|
||||||
use crate::WIDGET_SPACING;
|
|
||||||
use eframe::egui::text::LayoutJob;
|
use eframe::egui::text::LayoutJob;
|
||||||
use eframe::egui::Context;
|
use eframe::egui::Context;
|
||||||
use eframe::egui::FontId;
|
use eframe::egui::FontId;
|
||||||
@@ -148,7 +147,7 @@ impl BarWidget for Battery {
|
|||||||
TextFormat::simple(font_id, ctx.style().visuals.text_color()),
|
TextFormat::simple(font_id, ctx.style().visuals.text_color()),
|
||||||
);
|
);
|
||||||
|
|
||||||
config.grouping.apply_on_widget(ui, |ui| {
|
config.grouping.apply_on_widget(true, ui, |ui| {
|
||||||
ui.add(
|
ui.add(
|
||||||
Label::new(layout_job)
|
Label::new(layout_job)
|
||||||
.selectable(false)
|
.selectable(false)
|
||||||
@@ -156,8 +155,6 @@ impl BarWidget for Battery {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ui.add_space(WIDGET_SPACING);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
use crate::config::LabelPrefix;
|
use crate::config::LabelPrefix;
|
||||||
use crate::widget::BarWidget;
|
use crate::widget::BarWidget;
|
||||||
use crate::widget::RenderConfig;
|
use crate::widget::RenderConfig;
|
||||||
use crate::WIDGET_SPACING;
|
|
||||||
use eframe::egui::text::LayoutJob;
|
use eframe::egui::text::LayoutJob;
|
||||||
use eframe::egui::Context;
|
use eframe::egui::Context;
|
||||||
use eframe::egui::FontId;
|
use eframe::egui::FontId;
|
||||||
@@ -100,7 +99,7 @@ impl BarWidget for Cpu {
|
|||||||
TextFormat::simple(font_id, ctx.style().visuals.text_color()),
|
TextFormat::simple(font_id, ctx.style().visuals.text_color()),
|
||||||
);
|
);
|
||||||
|
|
||||||
config.grouping.apply_on_widget(ui, |ui| {
|
config.grouping.apply_on_widget(true, ui, |ui| {
|
||||||
if ui
|
if ui
|
||||||
.add(
|
.add(
|
||||||
Label::new(layout_job)
|
Label::new(layout_job)
|
||||||
@@ -117,8 +116,6 @@ impl BarWidget for Cpu {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ui.add_space(WIDGET_SPACING);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
use crate::config::LabelPrefix;
|
use crate::config::LabelPrefix;
|
||||||
use crate::widget::BarWidget;
|
use crate::widget::BarWidget;
|
||||||
use crate::widget::RenderConfig;
|
use crate::widget::RenderConfig;
|
||||||
use crate::WIDGET_SPACING;
|
|
||||||
use eframe::egui::text::LayoutJob;
|
use eframe::egui::text::LayoutJob;
|
||||||
use eframe::egui::Context;
|
use eframe::egui::Context;
|
||||||
use eframe::egui::FontId;
|
use eframe::egui::FontId;
|
||||||
@@ -120,7 +119,7 @@ impl BarWidget for Date {
|
|||||||
TextFormat::simple(font_id, ctx.style().visuals.text_color()),
|
TextFormat::simple(font_id, ctx.style().visuals.text_color()),
|
||||||
);
|
);
|
||||||
|
|
||||||
config.grouping.apply_on_widget(ui, |ui| {
|
config.grouping.apply_on_widget(true, ui, |ui| {
|
||||||
if ui
|
if ui
|
||||||
.add(
|
.add(
|
||||||
Label::new(WidgetText::LayoutJob(layout_job.clone()))
|
Label::new(WidgetText::LayoutJob(layout_job.clone()))
|
||||||
@@ -133,8 +132,6 @@ impl BarWidget for Date {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ui.add_space(WIDGET_SPACING);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+40
-19
@@ -1,5 +1,6 @@
|
|||||||
use crate::config::Color32Ext;
|
use crate::config::Color32Ext;
|
||||||
use crate::BACKGROUND_COLOR;
|
use crate::BACKGROUND_COLOR;
|
||||||
|
use crate::WIDGET_SPACING;
|
||||||
use eframe::egui::Color32;
|
use eframe::egui::Color32;
|
||||||
use eframe::egui::Frame;
|
use eframe::egui::Frame;
|
||||||
use eframe::egui::InnerResponse;
|
use eframe::egui::InnerResponse;
|
||||||
@@ -18,10 +19,10 @@ use std::sync::atomic::Ordering;
|
|||||||
pub enum Grouping {
|
pub enum Grouping {
|
||||||
/// No grouping is applied
|
/// No grouping is applied
|
||||||
None,
|
None,
|
||||||
/// Widgets are grouped on the bar
|
/// Widgets are grouped as a whole
|
||||||
Bar(GroupingConfig),
|
Bar(GroupingConfig),
|
||||||
/// Widgets are grouped on each side
|
/// Widgets are grouped by alignment
|
||||||
Side(GroupingConfig),
|
Alignment(GroupingConfig),
|
||||||
/// Widgets are grouped individually
|
/// Widgets are grouped individually
|
||||||
Widget(GroupingConfig),
|
Widget(GroupingConfig),
|
||||||
}
|
}
|
||||||
@@ -33,43 +34,52 @@ impl Grouping {
|
|||||||
add_contents: impl FnOnce(&mut Ui) -> R,
|
add_contents: impl FnOnce(&mut Ui) -> R,
|
||||||
) -> InnerResponse<R> {
|
) -> InnerResponse<R> {
|
||||||
match self {
|
match self {
|
||||||
Self::Bar(config) => Self::define_frame(ui, config).show(ui, add_contents),
|
Self::Bar(config) => Self::define_group(false, ui, add_contents, config),
|
||||||
Self::Side(_) => Self::default_response(ui, add_contents),
|
Self::Alignment(_) => Self::no_group(ui, add_contents),
|
||||||
Self::Widget(_) => Self::default_response(ui, add_contents),
|
Self::Widget(_) => Self::no_group(ui, add_contents),
|
||||||
Self::None => Self::default_response(ui, add_contents),
|
Self::None => Self::no_group(ui, add_contents),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn apply_on_side<R>(
|
pub fn apply_on_alignment<R>(
|
||||||
&mut self,
|
&mut self,
|
||||||
ui: &mut Ui,
|
ui: &mut Ui,
|
||||||
add_contents: impl FnOnce(&mut Ui) -> R,
|
add_contents: impl FnOnce(&mut Ui) -> R,
|
||||||
) -> InnerResponse<R> {
|
) -> InnerResponse<R> {
|
||||||
match self {
|
match self {
|
||||||
Self::Bar(_) => Self::default_response(ui, add_contents),
|
Self::Bar(_) => Self::no_group(ui, add_contents),
|
||||||
Self::Side(config) => Self::define_frame(ui, config).show(ui, add_contents),
|
Self::Alignment(config) => Self::define_group(false, ui, add_contents, config),
|
||||||
Self::Widget(_) => Self::default_response(ui, add_contents),
|
Self::Widget(_) => Self::no_group(ui, add_contents),
|
||||||
Self::None => Self::default_response(ui, add_contents),
|
Self::None => Self::no_group(ui, add_contents),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn apply_on_widget<R>(
|
pub fn apply_on_widget<R>(
|
||||||
&mut self,
|
&mut self,
|
||||||
|
use_spacing: bool,
|
||||||
ui: &mut Ui,
|
ui: &mut Ui,
|
||||||
add_contents: impl FnOnce(&mut Ui) -> R,
|
add_contents: impl FnOnce(&mut Ui) -> R,
|
||||||
) -> InnerResponse<R> {
|
) -> InnerResponse<R> {
|
||||||
match self {
|
match self {
|
||||||
Self::Bar(_) => Self::default_response(ui, add_contents),
|
Self::Bar(_) => Self::widget_group(use_spacing, ui, add_contents),
|
||||||
Self::Side(_) => Self::default_response(ui, add_contents),
|
Self::Alignment(_) => Self::widget_group(use_spacing, ui, add_contents),
|
||||||
Self::Widget(config) => Self::define_frame(ui, config).show(ui, add_contents),
|
Self::Widget(config) => Self::define_group(use_spacing, ui, add_contents, config),
|
||||||
Self::None => Self::default_response(ui, add_contents),
|
Self::None => Self::widget_group(use_spacing, ui, add_contents),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn define_frame(ui: &mut Ui, config: &mut GroupingConfig) -> Frame {
|
fn define_group<R>(
|
||||||
|
use_spacing: bool,
|
||||||
|
ui: &mut Ui,
|
||||||
|
add_contents: impl FnOnce(&mut Ui) -> R,
|
||||||
|
config: &mut GroupingConfig,
|
||||||
|
) -> InnerResponse<R> {
|
||||||
Frame::none()
|
Frame::none()
|
||||||
.outer_margin(Margin::same(0.0))
|
.outer_margin(Margin::same(0.0))
|
||||||
.inner_margin(Margin::symmetric(3.0, 3.0))
|
.inner_margin(match use_spacing {
|
||||||
|
true => Margin::symmetric(WIDGET_SPACING / 2.0 + 3.0, 3.0),
|
||||||
|
false => Margin::symmetric(3.0, 3.0),
|
||||||
|
})
|
||||||
.stroke(ui.style().visuals.widgets.noninteractive.bg_stroke)
|
.stroke(ui.style().visuals.widgets.noninteractive.bg_stroke)
|
||||||
.rounding(match config.rounding {
|
.rounding(match config.rounding {
|
||||||
Some(rounding) => rounding.into(),
|
Some(rounding) => rounding.into(),
|
||||||
@@ -92,12 +102,23 @@ impl Grouping {
|
|||||||
},
|
},
|
||||||
None => Shadow::NONE,
|
None => Shadow::NONE,
|
||||||
})
|
})
|
||||||
|
.show(ui, add_contents)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn default_response<R>(
|
fn widget_group<R>(
|
||||||
|
use_spacing: bool,
|
||||||
ui: &mut Ui,
|
ui: &mut Ui,
|
||||||
add_contents: impl FnOnce(&mut Ui) -> R,
|
add_contents: impl FnOnce(&mut Ui) -> R,
|
||||||
) -> InnerResponse<R> {
|
) -> InnerResponse<R> {
|
||||||
|
Frame::none()
|
||||||
|
.inner_margin(match use_spacing {
|
||||||
|
true => Margin::symmetric(WIDGET_SPACING / 2.0, 0.0),
|
||||||
|
false => Margin::same(0.0),
|
||||||
|
})
|
||||||
|
.show(ui, add_contents)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn no_group<R>(ui: &mut Ui, add_contents: impl FnOnce(&mut Ui) -> R) -> InnerResponse<R> {
|
||||||
InnerResponse {
|
InnerResponse {
|
||||||
inner: add_contents(ui),
|
inner: add_contents(ui),
|
||||||
response: ui.response().clone(),
|
response: ui.response().clone(),
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ use crate::ui::CustomUi;
|
|||||||
use crate::widget::BarWidget;
|
use crate::widget::BarWidget;
|
||||||
use crate::widget::RenderConfig;
|
use crate::widget::RenderConfig;
|
||||||
use crate::MAX_LABEL_WIDTH;
|
use crate::MAX_LABEL_WIDTH;
|
||||||
use crate::WIDGET_SPACING;
|
|
||||||
use crossbeam_channel::Receiver;
|
use crossbeam_channel::Receiver;
|
||||||
use crossbeam_channel::TryRecvError;
|
use crossbeam_channel::TryRecvError;
|
||||||
use eframe::egui::text::LayoutJob;
|
use eframe::egui::text::LayoutJob;
|
||||||
@@ -130,7 +129,7 @@ impl BarWidget for Komorebi {
|
|||||||
let mut update = None;
|
let mut update = None;
|
||||||
|
|
||||||
// NOTE: There should always be at least one workspace.
|
// NOTE: There should always be at least one workspace.
|
||||||
config.grouping.apply_on_widget(ui, |ui| {
|
config.grouping.apply_on_widget(false, ui, |ui| {
|
||||||
for (i, (ws, should_show)) in
|
for (i, (ws, should_show)) in
|
||||||
komorebi_notification_state.workspaces.iter().enumerate()
|
komorebi_notification_state.workspaces.iter().enumerate()
|
||||||
{
|
{
|
||||||
@@ -193,13 +192,11 @@ impl BarWidget for Komorebi {
|
|||||||
if let Some(update) = update {
|
if let Some(update) = update {
|
||||||
komorebi_notification_state.selected_workspace = update;
|
komorebi_notification_state.selected_workspace = update;
|
||||||
}
|
}
|
||||||
|
|
||||||
ui.add_space(WIDGET_SPACING);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(layout) = self.layout {
|
if let Some(layout) = self.layout {
|
||||||
if layout.enable {
|
if layout.enable {
|
||||||
config.grouping.apply_on_widget(ui, |ui| {
|
config.grouping.apply_on_widget(true, ui, |ui| {
|
||||||
if ui
|
if ui
|
||||||
.add(
|
.add(
|
||||||
Label::new(komorebi_notification_state.layout.to_string())
|
Label::new(komorebi_notification_state.layout.to_string())
|
||||||
@@ -242,8 +239,6 @@ impl BarWidget for Komorebi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ui.add_space(WIDGET_SPACING);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,7 +247,7 @@ impl BarWidget for Komorebi {
|
|||||||
for (name, location) in configuration_switcher.configurations.iter() {
|
for (name, location) in configuration_switcher.configurations.iter() {
|
||||||
let path = PathBuf::from(location);
|
let path = PathBuf::from(location);
|
||||||
if path.is_file() {
|
if path.is_file() {
|
||||||
config.grouping.apply_on_widget(ui,|ui|{
|
config.grouping.apply_on_widget(true, ui,|ui|{
|
||||||
if ui
|
if ui
|
||||||
.add(Label::new(name).selectable(false).sense(Sense::click()))
|
.add(Label::new(name).selectable(false).sense(Sense::click()))
|
||||||
.clicked()
|
.clicked()
|
||||||
@@ -302,8 +297,6 @@ impl BarWidget for Komorebi {
|
|||||||
}});
|
}});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ui.add_space(WIDGET_SPACING);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -312,7 +305,7 @@ impl BarWidget for Komorebi {
|
|||||||
let titles = &komorebi_notification_state.focused_container_information.0;
|
let titles = &komorebi_notification_state.focused_container_information.0;
|
||||||
|
|
||||||
if !titles.is_empty() {
|
if !titles.is_empty() {
|
||||||
config.grouping.apply_on_widget(ui, |ui| {
|
config.grouping.apply_on_widget(true, ui, |ui| {
|
||||||
let icons = &komorebi_notification_state.focused_container_information.1;
|
let icons = &komorebi_notification_state.focused_container_information.1;
|
||||||
let focused_window_idx =
|
let focused_window_idx =
|
||||||
komorebi_notification_state.focused_container_information.2;
|
komorebi_notification_state.focused_container_information.2;
|
||||||
@@ -418,14 +411,10 @@ impl BarWidget for Komorebi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ui.add_space(WIDGET_SPACING);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ui.add_space(WIDGET_SPACING);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ use crate::ui::CustomUi;
|
|||||||
use crate::widget::BarWidget;
|
use crate::widget::BarWidget;
|
||||||
use crate::widget::RenderConfig;
|
use crate::widget::RenderConfig;
|
||||||
use crate::MAX_LABEL_WIDTH;
|
use crate::MAX_LABEL_WIDTH;
|
||||||
use crate::WIDGET_SPACING;
|
|
||||||
use eframe::egui::text::LayoutJob;
|
use eframe::egui::text::LayoutJob;
|
||||||
use eframe::egui::Context;
|
use eframe::egui::Context;
|
||||||
use eframe::egui::FontId;
|
use eframe::egui::FontId;
|
||||||
@@ -103,7 +102,7 @@ impl BarWidget for Media {
|
|||||||
TextFormat::simple(font_id, ctx.style().visuals.text_color()),
|
TextFormat::simple(font_id, ctx.style().visuals.text_color()),
|
||||||
);
|
);
|
||||||
|
|
||||||
config.grouping.apply_on_widget(ui, |ui| {
|
config.grouping.apply_on_widget(true, ui, |ui| {
|
||||||
let available_height = ui.available_height();
|
let available_height = ui.available_height();
|
||||||
let mut custom_ui = CustomUi(ui);
|
let mut custom_ui = CustomUi(ui);
|
||||||
|
|
||||||
@@ -123,8 +122,6 @@ impl BarWidget for Media {
|
|||||||
self.toggle();
|
self.toggle();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ui.add_space(WIDGET_SPACING);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
use crate::config::LabelPrefix;
|
use crate::config::LabelPrefix;
|
||||||
use crate::widget::BarWidget;
|
use crate::widget::BarWidget;
|
||||||
use crate::widget::RenderConfig;
|
use crate::widget::RenderConfig;
|
||||||
use crate::WIDGET_SPACING;
|
|
||||||
use eframe::egui::text::LayoutJob;
|
use eframe::egui::text::LayoutJob;
|
||||||
use eframe::egui::Context;
|
use eframe::egui::Context;
|
||||||
use eframe::egui::FontId;
|
use eframe::egui::FontId;
|
||||||
@@ -103,7 +102,7 @@ impl BarWidget for Memory {
|
|||||||
TextFormat::simple(font_id, ctx.style().visuals.text_color()),
|
TextFormat::simple(font_id, ctx.style().visuals.text_color()),
|
||||||
);
|
);
|
||||||
|
|
||||||
config.grouping.apply_on_widget(ui, |ui| {
|
config.grouping.apply_on_widget(true, ui, |ui| {
|
||||||
if ui
|
if ui
|
||||||
.add(
|
.add(
|
||||||
Label::new(layout_job)
|
Label::new(layout_job)
|
||||||
@@ -120,8 +119,6 @@ impl BarWidget for Memory {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ui.add_space(WIDGET_SPACING);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
use crate::config::LabelPrefix;
|
use crate::config::LabelPrefix;
|
||||||
use crate::widget::BarWidget;
|
use crate::widget::BarWidget;
|
||||||
use crate::widget::RenderConfig;
|
use crate::widget::RenderConfig;
|
||||||
use crate::WIDGET_SPACING;
|
|
||||||
use eframe::egui::text::LayoutJob;
|
use eframe::egui::text::LayoutJob;
|
||||||
use eframe::egui::Context;
|
use eframe::egui::Context;
|
||||||
use eframe::egui::FontId;
|
use eframe::egui::FontId;
|
||||||
@@ -321,22 +320,18 @@ impl BarWidget for Network {
|
|||||||
fn render(&mut self, ctx: &Context, ui: &mut Ui, mut config: RenderConfig) {
|
fn render(&mut self, ctx: &Context, ui: &mut Ui, mut config: RenderConfig) {
|
||||||
if self.show_total_data_transmitted {
|
if self.show_total_data_transmitted {
|
||||||
for output in self.total_data_transmitted() {
|
for output in self.total_data_transmitted() {
|
||||||
config.grouping.apply_on_widget(ui, |ui| {
|
config.grouping.apply_on_widget(true, ui, |ui| {
|
||||||
ui.add(Label::new(output).selectable(false));
|
ui.add(Label::new(output).selectable(false));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ui.add_space(WIDGET_SPACING);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.show_network_activity {
|
if self.show_network_activity {
|
||||||
for output in self.network_activity() {
|
for output in self.network_activity() {
|
||||||
config.grouping.apply_on_widget(ui, |ui| {
|
config.grouping.apply_on_widget(true, ui, |ui| {
|
||||||
ui.add(Label::new(output).selectable(false));
|
ui.add(Label::new(output).selectable(false));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ui.add_space(WIDGET_SPACING);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.enable {
|
if self.enable {
|
||||||
@@ -372,7 +367,7 @@ impl BarWidget for Network {
|
|||||||
TextFormat::simple(font_id, ctx.style().visuals.text_color()),
|
TextFormat::simple(font_id, ctx.style().visuals.text_color()),
|
||||||
);
|
);
|
||||||
|
|
||||||
config.grouping.apply_on_widget(ui, |ui| {
|
config.grouping.apply_on_widget(true, ui, |ui| {
|
||||||
if ui
|
if ui
|
||||||
.add(
|
.add(
|
||||||
Label::new(layout_job)
|
Label::new(layout_job)
|
||||||
@@ -387,8 +382,6 @@ impl BarWidget for Network {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ui.add_space(WIDGET_SPACING);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
use crate::config::LabelPrefix;
|
use crate::config::LabelPrefix;
|
||||||
use crate::widget::BarWidget;
|
use crate::widget::BarWidget;
|
||||||
use crate::widget::RenderConfig;
|
use crate::widget::RenderConfig;
|
||||||
use crate::WIDGET_SPACING;
|
|
||||||
use eframe::egui::text::LayoutJob;
|
use eframe::egui::text::LayoutJob;
|
||||||
use eframe::egui::Context;
|
use eframe::egui::Context;
|
||||||
use eframe::egui::FontId;
|
use eframe::egui::FontId;
|
||||||
@@ -108,7 +107,7 @@ impl BarWidget for Storage {
|
|||||||
TextFormat::simple(font_id.clone(), ctx.style().visuals.text_color()),
|
TextFormat::simple(font_id.clone(), ctx.style().visuals.text_color()),
|
||||||
);
|
);
|
||||||
|
|
||||||
config.grouping.apply_on_widget(ui, |ui| {
|
config.grouping.apply_on_widget(true, ui, |ui| {
|
||||||
if ui
|
if ui
|
||||||
.add(
|
.add(
|
||||||
Label::new(layout_job)
|
Label::new(layout_job)
|
||||||
@@ -129,8 +128,6 @@ impl BarWidget for Storage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ui.add_space(WIDGET_SPACING);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
use crate::config::LabelPrefix;
|
use crate::config::LabelPrefix;
|
||||||
use crate::widget::BarWidget;
|
use crate::widget::BarWidget;
|
||||||
use crate::widget::RenderConfig;
|
use crate::widget::RenderConfig;
|
||||||
use crate::WIDGET_SPACING;
|
|
||||||
use eframe::egui::text::LayoutJob;
|
use eframe::egui::text::LayoutJob;
|
||||||
use eframe::egui::Context;
|
use eframe::egui::Context;
|
||||||
use eframe::egui::FontId;
|
use eframe::egui::FontId;
|
||||||
@@ -111,7 +110,7 @@ impl BarWidget for Time {
|
|||||||
TextFormat::simple(font_id, ctx.style().visuals.text_color()),
|
TextFormat::simple(font_id, ctx.style().visuals.text_color()),
|
||||||
);
|
);
|
||||||
|
|
||||||
config.grouping.apply_on_widget(ui, |ui| {
|
config.grouping.apply_on_widget(true, ui, |ui| {
|
||||||
if ui
|
if ui
|
||||||
.add(
|
.add(
|
||||||
Label::new(layout_job)
|
Label::new(layout_job)
|
||||||
@@ -124,8 +123,6 @@ impl BarWidget for Time {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ui.add_space(WIDGET_SPACING);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user