mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-05-20 02:36:55 +02:00
feat(bar): add widget grouping options
This commit adds various widget grouping and transparency options to komorebi-bar, and is comprised of the individual commits listed below, worked on in PR #1108, squashed into one.e8f5952abb* adding RenderConfig, and some test frames on widgets0a5e0a4c0a* no clonea5a7d6906c* comment6a91dd46cd* ignore unused80f0214e47* Group enum, Copy RenderConfigfbe5e2c1f7* Group -> Groupingce49b433f9* GroupingConfigf446a6a45f* "fmt --check" fix (thanks VS)d188222be7* added widget grouping and group module1008ec2031* rounding from settings, and apply_on_side7fff6d29a9* dereferencing655e8ce4c1* AlphaColour, transparency, bar background, more grouping config optionscba0fcd882* added RoundingConfigec5f7dc82d* handling grouping edge case for komorebi focus window12117b832b* changed default values645c46beb8* background color using theme color, AlphaColour.to_color32_or, updating json format for Grouping and RoundingConfig10d2ab21c7* hot-reload on groupingd88774328a* grouping correction on init2cd237fd0d* added shadow to grouping, optional width on grouping stroke4f4b617f26* grouping on bar, converting AlphaColour from_rgba_unmultiplied, simplified grouping3808fcec8f* widget rounding based on grouping, atomic background color, simplified config, style on groupingbe45d14f6d* renamed Side to Alignment, group spacingbe45d14f6d* proper widget spacing based on alignmentb43a5bda69* added widget_spacing to configc18e5f4dbe* test commitcba2b2f7ac* refactoring of render and grouping, widget spacing WIP9311cb00ec* simplify no_spacing36c267246b* correct spacing on komorebi and network widgets (WIP)85a41bf5b2* correct widget spacing on all widgets50b49ccf69* refactoring widget spacing9ec67ad988* account for ui item_spacing when setting the widget_spacinge88a2fd9c0* format
This commit is contained in:
+21
-21
@@ -1,7 +1,7 @@
|
||||
use crate::render::RenderConfig;
|
||||
use crate::ui::CustomUi;
|
||||
use crate::widget::BarWidget;
|
||||
use crate::MAX_LABEL_WIDTH;
|
||||
use crate::WIDGET_SPACING;
|
||||
use eframe::egui::text::LayoutJob;
|
||||
use eframe::egui::Context;
|
||||
use eframe::egui::FontId;
|
||||
@@ -78,7 +78,7 @@ impl Media {
|
||||
}
|
||||
|
||||
impl BarWidget for Media {
|
||||
fn render(&mut self, ctx: &Context, ui: &mut Ui) {
|
||||
fn render(&mut self, ctx: &Context, ui: &mut Ui, config: &mut RenderConfig) {
|
||||
if self.enable {
|
||||
let output = self.output();
|
||||
if !output.is_empty() {
|
||||
@@ -102,26 +102,26 @@ impl BarWidget for Media {
|
||||
TextFormat::simple(font_id, ctx.style().visuals.text_color()),
|
||||
);
|
||||
|
||||
let available_height = ui.available_height();
|
||||
let mut custom_ui = CustomUi(ui);
|
||||
config.apply_on_widget(true, ui, |ui| {
|
||||
let available_height = ui.available_height();
|
||||
let mut custom_ui = CustomUi(ui);
|
||||
|
||||
if custom_ui
|
||||
.add_sized_left_to_right(
|
||||
Vec2::new(
|
||||
MAX_LABEL_WIDTH.load(Ordering::SeqCst) as f32,
|
||||
available_height,
|
||||
),
|
||||
Label::new(layout_job)
|
||||
.selectable(false)
|
||||
.sense(Sense::click())
|
||||
.truncate(),
|
||||
)
|
||||
.clicked()
|
||||
{
|
||||
self.toggle();
|
||||
}
|
||||
|
||||
ui.add_space(WIDGET_SPACING);
|
||||
if custom_ui
|
||||
.add_sized_left_to_right(
|
||||
Vec2::new(
|
||||
MAX_LABEL_WIDTH.load(Ordering::SeqCst) as f32,
|
||||
available_height,
|
||||
),
|
||||
Label::new(layout_job)
|
||||
.selectable(false)
|
||||
.sense(Sense::click())
|
||||
.truncate(),
|
||||
)
|
||||
.clicked()
|
||||
{
|
||||
self.toggle();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user