[GH-ISSUE #1244] Popups in bar's end shift right on certain events #1785

Open
opened 2026-05-22 22:54:39 +01:00 by JakeStanger · 4 comments
Owner

Originally created by @postsolar on GitHub (Nov 20, 2025).
Original GitHub issue: https://github.com/JakeStanger/ironbar/issues/1244

Describe the bug

Popups in bar's end shift a certain constant amount of pixels on certain events, such as volume change. Maybe the root cause is respective button changing its width.

To reproduce
Steps to reproduce the behavior:

  1. Add modules volume and clock to bar end
  2. Click clock popup
  3. Increase/decrease/mute volume via your favorite program, volume widget's width changes (doesnt appear to matter which direction it changes, wider or narrower)
  4. Popup shifts right

Expected behavior

Popup remains static

System information:

  • Distro: NixOS
  • Compositor: Hyprland master
  • Ironbar version: current master f20a679

Configuration

Config

Styles

Additional context

Screenshots

https://github.com/user-attachments/assets/dfcf9966-eaf5-4eca-8535-09f7046cfaa9

style.css

config.json

Originally created by @postsolar on GitHub (Nov 20, 2025). Original GitHub issue: https://github.com/JakeStanger/ironbar/issues/1244 **Describe the bug** <!-- A clear and concise description of what the bug is. --> Popups in bar's end shift a certain constant amount of pixels on certain events, such as volume change. _Maybe_ the root cause is respective button changing its width. **To reproduce** Steps to reproduce the behavior: 1. Add modules `volume` and `clock` to bar end 2. Click clock popup 3. Increase/decrease/mute volume via your favorite program, volume widget's width changes (doesnt appear to matter which direction it changes, wider or narrower) 4. Popup shifts right **Expected behavior** <!-- A clear and concise description of what you expected to happen. --> Popup remains static **System information:** - Distro: NixOS - Compositor: Hyprland master - Ironbar version: current master [f20a679](https://github.com/JakeStanger/ironbar/commit/f20a679a3e1bf7eb327337dc980a6222bb25e169) **Configuration** <!-- Share your bar configuration and stylesheet as applicable: --> <details><summary>Config</summary> ``` ``` </details> <details><summary>Styles</summary> ```css ``` </details> **Additional context** <!-- Add any other context about the problem here. --> **Screenshots** <!-- If applicable, add screenshots to help explain your problem. --> https://github.com/user-attachments/assets/dfcf9966-eaf5-4eca-8535-09f7046cfaa9 [style.css](https://github.com/user-attachments/files/23664689/style.css) [config.json](https://github.com/user-attachments/files/23664692/config.json)
Author
Owner

@JakeStanger commented on GitHub (Nov 20, 2025):

Maybe the root cause is respective button changing its width

Looks like that's what is happening to me. The popup will re-center itself on the button if it changes size or position. I'm not sure what the best solution to that would be?

<!-- gh-comment-id:3560512902 --> @JakeStanger commented on GitHub (Nov 20, 2025): > Maybe the root cause is respective button changing its width Looks like that's what is happening to me. The popup will re-center itself on the button if it changes size or position. I'm not sure what the best solution to that would be?
Author
Owner

@postsolar commented on GitHub (Nov 20, 2025):

Right after posting this I realized it could be fixed with

.volume {
  min-width: 50px;
}

😅

But I mean this wasn't required before, so feel free to decide if this issue should be closed or kept open.

Looks like that's what is happening to me. The popup will re-center itself on the button if it changes size or position. I'm not sure what the best solution to that would be?

I fed this problem to Claude-Code, it suggested

A quick fix is to anchor the popover to a specific position on the button using pointing_to. Let me show you the change:

● Update(src/popup.rs)
  ⎿  User rejected update to src/popup.rs
       153                self.popover.set_child(Some(content));
       154                self.popover.unparent();
       155                self.popover.set_parent(&button);
       156 +  
       157 +              // Anchor to button center to prevent position shifts
       158 +              let allocation = button.allocation();
       159 +              let rect = gtk::gdk::Rectangle::new(
       160 +                  allocation.width() / 2,
       161 +                  allocation.height() / 2,
       162 +                  0,
       163 +                  0,
       164 +              );
       165 +              self.popover.set_pointing_to(Some(&rect));
       166 +  
       167                self.popover.popup();
       168            }
       169        }

but I didn't feel like compiling or thinking too much about it.

<!-- gh-comment-id:3560527630 --> @postsolar commented on GitHub (Nov 20, 2025): Right after posting this I realized it could be fixed with ```css .volume { min-width: 50px; } ``` 😅 But I mean this wasn't required before, so feel free to decide if this issue should be closed or kept open. > Looks like that's what is happening to me. The popup will re-center itself on the button if it changes size or position. I'm not sure what the best solution to that would be? I fed this problem to Claude-Code, it suggested ``` A quick fix is to anchor the popover to a specific position on the button using pointing_to. Let me show you the change: ● Update(src/popup.rs) ⎿  User rejected update to src/popup.rs 153 self.popover.set_child(Some(content)); 154 self.popover.unparent(); 155 self.popover.set_parent(&button); 156 + 157 + // Anchor to button center to prevent position shifts 158 + let allocation = button.allocation(); 159 + let rect = gtk::gdk::Rectangle::new( 160 + allocation.width() / 2, 161 + allocation.height() / 2, 162 + 0, 163 + 0, 164 + ); 165 + self.popover.set_pointing_to(Some(&rect)); 166 + 167 self.popover.popup(); 168 } 169 } ``` but I didn't feel like compiling or thinking too much about it.
Author
Owner

@postsolar commented on GitHub (Nov 20, 2025):

TBH I'm not that sure about the re-centering. If this was the case, wouldn't the popup be shifting back on button's width decrease, too? On my screen recording it does not. It only goes one way, once, until closing the popup resets it.

<!-- gh-comment-id:3560546948 --> @postsolar commented on GitHub (Nov 20, 2025): TBH I'm not that sure about the re-centering. If this was the case, wouldn't the popup be shifting *back* on button's width decrease, too? On my screen recording it does not. It only goes one way, once, until closing the popup resets it.
Author
Owner

@JakeStanger commented on GitHub (Nov 20, 2025):

this wasn't required before

You might be right. I think the GTK3 version handled the logic the other way around - the popup was repositioned to the button if the popup changed size (which the GTK4 version does still do), but didn't reposition if the button moved.

The additional logic is handled by GTK since it's a native popup, whereas in GTK3 it was a separate window and margin hacks. I'm not sure why it wouldn't shift back but I'd put it down to GTK trying to be clever.

I'll need to double-check that, but if so anchoring the popup to specific geometry is probably sensible. I'd also class it as a regression if so.

<!-- gh-comment-id:3560554261 --> @JakeStanger commented on GitHub (Nov 20, 2025): > this wasn't required before You might be right. I think the GTK3 version handled the logic the other way around - the popup was repositioned to the button if the *popup* changed size (which the GTK4 version does still do), but didn't reposition if the button moved. The additional logic is handled by GTK since it's a native popup, whereas in GTK3 it was a separate window and margin hacks. I'm not sure why it wouldn't shift back but I'd put it down to GTK trying to be clever. I'll need to double-check that, but if so anchoring the popup to specific geometry is probably sensible. I'd also class it as a regression if so.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
JakeStanger/ironbar#1785
No description provided.