1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-04-19 19:34:24 +02:00

fix(upower): icon outside button

This moves the upower battery icon to inside the button,
moving it before the label for consistency.
This commit is contained in:
Jake Stanger 2023-05-26 18:58:30 +01:00
parent b9740cba8f
commit a6b686624b
2 changed files with 17 additions and 16 deletions

View file

@ -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).
For more information on styling, please see the [styling guide](styling-guide).

View file

@ -41,7 +41,7 @@ pub struct UpowerProperties {
time_to_empty: i64,
}
impl Module<gtk::Box> for UpowerModule {
impl Module<gtk::Button> for UpowerModule {
type SendMessage = UpowerProperties;
type ReceiveMessage = ();
@ -143,7 +143,7 @@ impl Module<gtk::Box> for UpowerModule {
self,
context: WidgetContext<Self::SendMessage, Self::ReceiveMessage>,
info: &ModuleInfo,
) -> Result<ModuleWidget<gtk::Box>> {
) -> Result<ModuleWidget<Button>> {
let icon_theme = info.icon_theme.clone();
let icon = gtk::Image::new();
add_class(&icon, "icon");
@ -154,15 +154,15 @@ impl Module<gtk::Box> 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| {
@ -189,7 +189,7 @@ impl Module<gtk::Box> for UpowerModule {
let popup = self.into_popup(context.controller_tx, context.popup_rx, info);
Ok(ModuleWidget {
widget: container,
widget: button,
popup,
})
}