mirror of
https://github.com/Zedfrigg/ironbar.git
synced 2025-07-02 03:01:04 +02:00
Merge pull request #192 from JakeStanger/fix/focused-icon
Fix focused icon issues
This commit is contained in:
commit
b3b96673b0
1 changed files with 10 additions and 4 deletions
|
@ -97,7 +97,10 @@ impl Module<gtk::Box> for FocusedModule {
|
||||||
let container = gtk::Box::new(info.bar_position.get_orientation(), 5);
|
let container = gtk::Box::new(info.bar_position.get_orientation(), 5);
|
||||||
|
|
||||||
let icon = gtk::Image::new();
|
let icon = gtk::Image::new();
|
||||||
|
if self.show_icon {
|
||||||
add_class(&icon, "icon");
|
add_class(&icon, "icon");
|
||||||
|
container.add(&icon);
|
||||||
|
}
|
||||||
|
|
||||||
let label = Label::new(None);
|
let label = Label::new(None);
|
||||||
add_class(&label, "label");
|
add_class(&label, "label");
|
||||||
|
@ -106,15 +109,18 @@ impl Module<gtk::Box> for FocusedModule {
|
||||||
truncate.truncate_label(&label);
|
truncate.truncate_label(&label);
|
||||||
}
|
}
|
||||||
|
|
||||||
container.add(&icon);
|
|
||||||
container.add(&label);
|
container.add(&label);
|
||||||
|
|
||||||
{
|
{
|
||||||
let icon_theme = icon_theme.clone();
|
let icon_theme = icon_theme.clone();
|
||||||
context.widget_rx.attach(None, move |(name, id)| {
|
context.widget_rx.attach(None, move |(name, id)| {
|
||||||
if self.show_icon {
|
if self.show_icon {
|
||||||
ImageProvider::parse(&id, &icon_theme, self.icon_size)
|
match ImageProvider::parse(&id, &icon_theme, self.icon_size)
|
||||||
.map(|image| image.load_into_image(icon.clone()));
|
.map(|image| image.load_into_image(icon.clone()))
|
||||||
|
{
|
||||||
|
Some(Ok(_)) => icon.show(),
|
||||||
|
_ => icon.hide(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.show_title {
|
if self.show_title {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue