mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-07-06 21:15:13 +02:00
feat(bar): indicate clickable widgets
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
use crate::config::LabelPrefix;
|
use crate::config::LabelPrefix;
|
||||||
use crate::render::RenderConfig;
|
use crate::render::RenderConfig;
|
||||||
|
use crate::selected_frame::SelectableFrame;
|
||||||
use crate::widget::BarWidget;
|
use crate::widget::BarWidget;
|
||||||
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;
|
||||||
use eframe::egui::Label;
|
use eframe::egui::Label;
|
||||||
use eframe::egui::Sense;
|
|
||||||
use eframe::egui::TextFormat;
|
use eframe::egui::TextFormat;
|
||||||
use eframe::egui::TextStyle;
|
use eframe::egui::TextStyle;
|
||||||
use eframe::egui::Ui;
|
use eframe::egui::Ui;
|
||||||
@@ -99,13 +99,9 @@ impl BarWidget for Cpu {
|
|||||||
TextFormat::simple(font_id, ctx.style().visuals.text_color()),
|
TextFormat::simple(font_id, ctx.style().visuals.text_color()),
|
||||||
);
|
);
|
||||||
|
|
||||||
config.apply_on_widget(true, ui, |ui| {
|
config.apply_on_widget(false, ui, |ui| {
|
||||||
if ui
|
if SelectableFrame::new(false)
|
||||||
.add(
|
.show(ui, |ui| ui.add(Label::new(layout_job).selectable(false)))
|
||||||
Label::new(layout_job)
|
|
||||||
.selectable(false)
|
|
||||||
.sense(Sense::click()),
|
|
||||||
)
|
|
||||||
.clicked()
|
.clicked()
|
||||||
{
|
{
|
||||||
if let Err(error) =
|
if let Err(error) =
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
use crate::config::LabelPrefix;
|
use crate::config::LabelPrefix;
|
||||||
use crate::render::RenderConfig;
|
use crate::render::RenderConfig;
|
||||||
|
use crate::selected_frame::SelectableFrame;
|
||||||
use crate::widget::BarWidget;
|
use crate::widget::BarWidget;
|
||||||
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;
|
||||||
use eframe::egui::Label;
|
use eframe::egui::Label;
|
||||||
use eframe::egui::Sense;
|
|
||||||
use eframe::egui::TextFormat;
|
use eframe::egui::TextFormat;
|
||||||
use eframe::egui::TextStyle;
|
use eframe::egui::TextStyle;
|
||||||
use eframe::egui::Ui;
|
use eframe::egui::Ui;
|
||||||
@@ -119,13 +119,14 @@ impl BarWidget for Date {
|
|||||||
TextFormat::simple(font_id, ctx.style().visuals.text_color()),
|
TextFormat::simple(font_id, ctx.style().visuals.text_color()),
|
||||||
);
|
);
|
||||||
|
|
||||||
config.apply_on_widget(true, ui, |ui| {
|
config.apply_on_widget(false, ui, |ui| {
|
||||||
if ui
|
if SelectableFrame::new(false)
|
||||||
.add(
|
.show(ui, |ui| {
|
||||||
Label::new(WidgetText::LayoutJob(layout_job.clone()))
|
ui.add(
|
||||||
.selectable(false)
|
Label::new(WidgetText::LayoutJob(layout_job.clone()))
|
||||||
.sense(Sense::click()),
|
.selectable(false),
|
||||||
)
|
)
|
||||||
|
})
|
||||||
.clicked()
|
.clicked()
|
||||||
{
|
{
|
||||||
self.format.next()
|
self.format.next()
|
||||||
|
|||||||
+14
-15
@@ -1,4 +1,5 @@
|
|||||||
use crate::render::RenderConfig;
|
use crate::render::RenderConfig;
|
||||||
|
use crate::selected_frame::SelectableFrame;
|
||||||
use crate::ui::CustomUi;
|
use crate::ui::CustomUi;
|
||||||
use crate::widget::BarWidget;
|
use crate::widget::BarWidget;
|
||||||
use crate::MAX_LABEL_WIDTH;
|
use crate::MAX_LABEL_WIDTH;
|
||||||
@@ -6,7 +7,6 @@ use eframe::egui::text::LayoutJob;
|
|||||||
use eframe::egui::Context;
|
use eframe::egui::Context;
|
||||||
use eframe::egui::FontId;
|
use eframe::egui::FontId;
|
||||||
use eframe::egui::Label;
|
use eframe::egui::Label;
|
||||||
use eframe::egui::Sense;
|
|
||||||
use eframe::egui::TextFormat;
|
use eframe::egui::TextFormat;
|
||||||
use eframe::egui::TextStyle;
|
use eframe::egui::TextStyle;
|
||||||
use eframe::egui::Ui;
|
use eframe::egui::Ui;
|
||||||
@@ -102,21 +102,20 @@ impl BarWidget for Media {
|
|||||||
TextFormat::simple(font_id, ctx.style().visuals.text_color()),
|
TextFormat::simple(font_id, ctx.style().visuals.text_color()),
|
||||||
);
|
);
|
||||||
|
|
||||||
config.apply_on_widget(true, ui, |ui| {
|
config.apply_on_widget(false, ui, |ui| {
|
||||||
let available_height = ui.available_height();
|
if SelectableFrame::new(false)
|
||||||
let mut custom_ui = CustomUi(ui);
|
.show(ui, |ui| {
|
||||||
|
let available_height = ui.available_height();
|
||||||
|
let mut custom_ui = CustomUi(ui);
|
||||||
|
|
||||||
if custom_ui
|
custom_ui.add_sized_left_to_right(
|
||||||
.add_sized_left_to_right(
|
Vec2::new(
|
||||||
Vec2::new(
|
MAX_LABEL_WIDTH.load(Ordering::SeqCst) as f32,
|
||||||
MAX_LABEL_WIDTH.load(Ordering::SeqCst) as f32,
|
available_height,
|
||||||
available_height,
|
),
|
||||||
),
|
Label::new(layout_job).selectable(false).truncate(),
|
||||||
Label::new(layout_job)
|
)
|
||||||
.selectable(false)
|
})
|
||||||
.sense(Sense::click())
|
|
||||||
.truncate(),
|
|
||||||
)
|
|
||||||
.clicked()
|
.clicked()
|
||||||
{
|
{
|
||||||
self.toggle();
|
self.toggle();
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
use crate::config::LabelPrefix;
|
use crate::config::LabelPrefix;
|
||||||
use crate::render::RenderConfig;
|
use crate::render::RenderConfig;
|
||||||
|
use crate::selected_frame::SelectableFrame;
|
||||||
use crate::widget::BarWidget;
|
use crate::widget::BarWidget;
|
||||||
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;
|
||||||
use eframe::egui::Label;
|
use eframe::egui::Label;
|
||||||
use eframe::egui::Sense;
|
|
||||||
use eframe::egui::TextFormat;
|
use eframe::egui::TextFormat;
|
||||||
use eframe::egui::TextStyle;
|
use eframe::egui::TextStyle;
|
||||||
use eframe::egui::Ui;
|
use eframe::egui::Ui;
|
||||||
@@ -102,13 +102,9 @@ impl BarWidget for Memory {
|
|||||||
TextFormat::simple(font_id, ctx.style().visuals.text_color()),
|
TextFormat::simple(font_id, ctx.style().visuals.text_color()),
|
||||||
);
|
);
|
||||||
|
|
||||||
config.apply_on_widget(true, ui, |ui| {
|
config.apply_on_widget(false, ui, |ui| {
|
||||||
if ui
|
if SelectableFrame::new(false)
|
||||||
.add(
|
.show(ui, |ui| ui.add(Label::new(layout_job).selectable(false)))
|
||||||
Label::new(layout_job)
|
|
||||||
.selectable(false)
|
|
||||||
.sense(Sense::click()),
|
|
||||||
)
|
|
||||||
.clicked()
|
.clicked()
|
||||||
{
|
{
|
||||||
if let Err(error) =
|
if let Err(error) =
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
use crate::config::LabelPrefix;
|
use crate::config::LabelPrefix;
|
||||||
use crate::render::RenderConfig;
|
use crate::render::RenderConfig;
|
||||||
|
use crate::selected_frame::SelectableFrame;
|
||||||
use crate::widget::BarWidget;
|
use crate::widget::BarWidget;
|
||||||
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;
|
||||||
use eframe::egui::Label;
|
use eframe::egui::Label;
|
||||||
use eframe::egui::Sense;
|
|
||||||
use eframe::egui::TextFormat;
|
use eframe::egui::TextFormat;
|
||||||
use eframe::egui::TextStyle;
|
use eframe::egui::TextStyle;
|
||||||
use eframe::egui::Ui;
|
use eframe::egui::Ui;
|
||||||
@@ -303,13 +303,9 @@ impl BarWidget for Network {
|
|||||||
TextFormat::simple(font_id, ctx.style().visuals.text_color()),
|
TextFormat::simple(font_id, ctx.style().visuals.text_color()),
|
||||||
);
|
);
|
||||||
|
|
||||||
config.apply_on_widget(true, ui, |ui| {
|
config.apply_on_widget(false, ui, |ui| {
|
||||||
if ui
|
if SelectableFrame::new(false)
|
||||||
.add(
|
.show(ui, |ui| ui.add(Label::new(layout_job).selectable(false)))
|
||||||
Label::new(layout_job)
|
|
||||||
.selectable(false)
|
|
||||||
.sense(Sense::click()),
|
|
||||||
)
|
|
||||||
.clicked()
|
.clicked()
|
||||||
{
|
{
|
||||||
if let Err(error) = Command::new("cmd.exe").args(["/C", "ncpa"]).spawn() {
|
if let Err(error) = Command::new("cmd.exe").args(["/C", "ncpa"]).spawn() {
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
use crate::config::LabelPrefix;
|
use crate::config::LabelPrefix;
|
||||||
use crate::render::RenderConfig;
|
use crate::render::RenderConfig;
|
||||||
|
use crate::selected_frame::SelectableFrame;
|
||||||
use crate::widget::BarWidget;
|
use crate::widget::BarWidget;
|
||||||
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;
|
||||||
use eframe::egui::Label;
|
use eframe::egui::Label;
|
||||||
use eframe::egui::Sense;
|
|
||||||
use eframe::egui::TextFormat;
|
use eframe::egui::TextFormat;
|
||||||
use eframe::egui::TextStyle;
|
use eframe::egui::TextStyle;
|
||||||
use eframe::egui::Ui;
|
use eframe::egui::Ui;
|
||||||
@@ -107,13 +107,9 @@ 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.apply_on_widget(true, ui, |ui| {
|
config.apply_on_widget(false, ui, |ui| {
|
||||||
if ui
|
if SelectableFrame::new(false)
|
||||||
.add(
|
.show(ui, |ui| ui.add(Label::new(layout_job).selectable(false)))
|
||||||
Label::new(layout_job)
|
|
||||||
.selectable(false)
|
|
||||||
.sense(Sense::click()),
|
|
||||||
)
|
|
||||||
.clicked()
|
.clicked()
|
||||||
{
|
{
|
||||||
if let Err(error) = Command::new("cmd.exe")
|
if let Err(error) = Command::new("cmd.exe")
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
use crate::config::LabelPrefix;
|
use crate::config::LabelPrefix;
|
||||||
use crate::render::RenderConfig;
|
use crate::render::RenderConfig;
|
||||||
|
use crate::selected_frame::SelectableFrame;
|
||||||
use crate::widget::BarWidget;
|
use crate::widget::BarWidget;
|
||||||
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;
|
||||||
use eframe::egui::Label;
|
use eframe::egui::Label;
|
||||||
use eframe::egui::Sense;
|
|
||||||
use eframe::egui::TextFormat;
|
use eframe::egui::TextFormat;
|
||||||
use eframe::egui::TextStyle;
|
use eframe::egui::TextStyle;
|
||||||
use eframe::egui::Ui;
|
use eframe::egui::Ui;
|
||||||
@@ -110,13 +110,9 @@ impl BarWidget for Time {
|
|||||||
TextFormat::simple(font_id, ctx.style().visuals.text_color()),
|
TextFormat::simple(font_id, ctx.style().visuals.text_color()),
|
||||||
);
|
);
|
||||||
|
|
||||||
config.apply_on_widget(true, ui, |ui| {
|
config.apply_on_widget(false, ui, |ui| {
|
||||||
if ui
|
if SelectableFrame::new(false)
|
||||||
.add(
|
.show(ui, |ui| ui.add(Label::new(layout_job).selectable(false)))
|
||||||
Label::new(layout_job)
|
|
||||||
.selectable(false)
|
|
||||||
.sense(Sense::click()),
|
|
||||||
)
|
|
||||||
.clicked()
|
.clicked()
|
||||||
{
|
{
|
||||||
self.format.toggle()
|
self.format.toggle()
|
||||||
|
|||||||
Reference in New Issue
Block a user