diff --git a/docs/modules/Upower.md b/docs/modules/Upower.md index 1d91a6e..102a556 100644 --- a/docs/modules/Upower.md +++ b/docs/modules/Upower.md @@ -70,13 +70,14 @@ end: ## Styling -| Selector | Description | -|---------------------------------|-----------------------------| -| `.upower` | Upower widget container. | -| `.upower .icon` | Upower widget battery icon. | -| `.upower .button` | Upower widget button. | -| `.upower .button .label` | Upower widget button label. | -| `.popup-upower` | Upower popup box. | -| `.popup-upower .upower-details` | Label inside the popup. | +| Selector | Description | +|---------------------------------|--------------------------------| +| `.upower` | Upower widget container. | +| `.upower .button` | Upower widget button. | +| `.upower .button .contents` | Upower widget button contents. | +| `.upower .button .icon` | Upower widget battery icon. | +| `.upower .button .label` | Upower widget button label. | +| `.popup-upower` | Upower popup box. | +| `.popup-upower .upower-details` | Label inside the popup. | -For more information on styling, please see the [styling guide](styling-guide). \ No newline at end of file +For more information on styling, please see the [styling guide](styling-guide). diff --git a/src/modules/upower.rs b/src/modules/upower.rs index 11b4051..4723feb 100644 --- a/src/modules/upower.rs +++ b/src/modules/upower.rs @@ -41,7 +41,7 @@ pub struct UpowerProperties { time_to_empty: i64, } -impl Module for UpowerModule { +impl Module for UpowerModule { type SendMessage = UpowerProperties; type ReceiveMessage = (); @@ -143,7 +143,7 @@ impl Module for UpowerModule { self, context: WidgetContext, info: &ModuleInfo, - ) -> Result> { + ) -> Result> { let icon_theme = info.icon_theme.clone(); let icon = gtk::Image::new(); add_class(&icon, "icon"); @@ -154,15 +154,15 @@ impl Module for UpowerModule { .build(); add_class(&label, "label"); - let container = gtk::Box::new(Orientation::Horizontal, 0); - add_class(&container, "upower"); + let container = gtk::Box::new(Orientation::Horizontal, 5); + add_class(&container, "contents"); let button = Button::new(); add_class(&button, "button"); - button.add(&label); - container.add(&button); container.add(&icon); + container.add(&label); + button.add(&container); let orientation = info.bar_position.get_orientation(); button.connect_clicked(move |button| { @@ -180,7 +180,7 @@ impl Module for UpowerModule { .attach(None, move |properties: UpowerProperties| { let format = format.replace("{percentage}", &properties.percentage.to_string()); let icon_name = String::from("icon:") + &properties.icon_name; - ImageProvider::parse(&icon_name, &icon_theme, 32) + ImageProvider::parse(&icon_name, &icon_theme, 24) .map(|provider| provider.load_into_image(icon.clone())); label.set_markup(format.as_ref()); Continue(true) @@ -189,7 +189,7 @@ impl Module for UpowerModule { let popup = self.into_popup(context.controller_tx, context.popup_rx, info); Ok(ModuleWidget { - widget: container, + widget: button, popup, }) }