ironbar icon indicating copy to clipboard operation
ironbar copied to clipboard

feat: Add Menu module

Open ClaireNeveu opened this issue 1 year ago • 7 comments

This PR adds a new Menu widget which allows users to create XDG or custom menus that open after clicking on a button.

Resolves #534

ClaireNeveu avatar May 24 '24 18:05 ClaireNeveu

Thanks for your hard work on this, and for spending the time to go through and review already. I'll try and go through your comments in the next few days, and then my own full review off the back of that.

Progress may be a little slower than usual on this from my end as I'm fairly busy at the moment, just FYI.

JakeStanger avatar May 24 '24 19:05 JakeStanger

Thanks for the heads up, Jake.

ClaireNeveu avatar May 24 '24 19:05 ClaireNeveu

One thing I forget to mention earlier: whenever I cause a reflow (by hiding or showing a submenu) all the UI elements jump a little bit. I wasn't able to figure out why that is.

ClaireNeveu avatar May 29 '24 20:05 ClaireNeveu

That may be due to this: https://github.com/JakeStanger/ironbar/blob/b5755ef9d495bdf623965562725a7c0b1d27ea04/src/popup.rs#L135

The popup will listen to changes in its size, and re-position itself to ensure it remains anchored to the widget it opened from. If appropriate, you could potentially avoid that by using the OpenPopupAt event instead of the OpenPopup one, and passing the buttons current static geometry.

JakeStanger avatar May 29 '24 20:05 JakeStanger

Oh cool, I spent a long time searching GTK issues and docs, didn't consider it could be something in Ironbar. I'll try to make that change and see if it fixes the issue.

ClaireNeveu avatar May 29 '24 20:05 ClaireNeveu

That may be due to this:

https://github.com/JakeStanger/ironbar/blob/b5755ef9d495bdf623965562725a7c0b1d27ea04/src/popup.rs#L135

The popup will listen to changes in its size, and re-position itself to ensure it remains anchored to the widget it opened from. If appropriate, you could potentially avoid that by using the OpenPopupAt event instead of the OpenPopup one, and passing the buttons current static geometry.

It doesn't seem like OpenPopupAt avoids this codepath but I tried just deleting that bit of code and it didn't fix the problem.

ClaireNeveu avatar May 30 '24 21:05 ClaireNeveu

Okay that's annoying. I'll try and test myself when I can, and see if I can spot what's going on.

JakeStanger avatar May 31 '24 10:05 JakeStanger

Looking to get this merged in the next couple of days. I've tidied the code a bit and brought it up to date with the changes from the last year but in general it was pretty much there already. Most of the work came from rewriting the desktop file and image code for performance improvements.

I appreciate it's been a full year now, but thanks for your work on this last year. This is a fairly big feature and a lot of effort clearly went into it.

JakeStanger avatar May 25 '25 22:05 JakeStanger

One thing I forget to mention earlier: whenever I cause a reflow (by hiding or showing a submenu) all the UI elements jump a little bit. I wasn't able to figure out why that is.

This actually seems to be something weird with Hyprland. I wasn't able to find out why, nor replicate it on other compositors so I'm shipping as-is. If anybody finds a fix I'm all ears.

JakeStanger avatar May 26 '25 09:05 JakeStanger