Set Adw.Clamp to a certain percentage of window size

Hi!

Relatively quick question. Is it possible to make an Adw.Clamp occupy a given % of the window? 30% for example.

adw_clamp_set_maximum_size only accepts an Adw.LengthUnit, which are px, pt and sp.

Thanks in advance!

In short: no, you can’t

1 Like

Is there any specific reason you’d like this? I’m having a hard time coming up with a case where having a variable maximum size is preferable to having a constant one :slightly_smiling_face:

Thank you both for your replies!

You’re spot on haha. The Adw.Clamp % solution would be to my problem Y.

My actual problem is that I have a window with a main element that expands, and an “episode list” on the right. I’ll attach a few images to illustrate it.

I’d like to do the following:

  • Have a max size for the episode list, up to a certain point (never covering too much of the window)
  • Gradually ellipsize more and more of the episode titles as the window gets smaller. If the window gets larger, ellipsize less to show more of the title

With a fixed width clamp

Without a clamp

With a clamp, the issue is that the title is permanently ellipsized, even if the window is wide enough to support a full title. Without the clamp, longer titles always occupy space to display everything, obscuring the main widget, no matter what the halign and hexpand properties are.

I thought that maybe if I could set the clamp to always occupy 30% of the window, the problem would be solved.

Clamp is absolutely not the right widget here in the first place. Have you looked at AdwNavigationSplitView and AdwOverlaySplitView? They do support percentages btw.

1 Like

Thank you very much! That is precisely what I was looking for!
There doesn’t seem to be a way to move the sidebar to the right side as of right now, is that correct?

The unstable release seems to have a set_sidebar_position method, though. Would I have to wait for that to move the sidebar to the right?

Thanks!

Edit:

I tried swapping sidebar and content, but that’s not exactly the desired solution because then I cannot control the min and max widths of the actual sidebar, which is set to the content to be on the right. ://

Similarly, is there a way to limit the sidebar widget to the natural size of its content?

Overlay split view has it in stable. Navigation split view only in main.

1 Like

Alright, I guess I’ll wait then! Out of curiosity, is there an ETA on the stable release of 1.7?

Thanks!

Why wait? Use overlay split view

1.7 will be released at the same time as every other GNOME 48 module, as always

1 Like

Fair enough :rofl:

Thank you for the information and all the help! Have a nice day!

1 Like