Skip to content

Labels cause neighboring objects on the panel to move #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Hyperchaotic opened this issue Mar 13, 2025 · 9 comments
Open

Labels cause neighboring objects on the panel to move #18

Hyperchaotic opened this issue Mar 13, 2025 · 9 comments

Comments

@Hyperchaotic
Copy link
Collaborator

Labels have some issues with sizing. They cause neighboring objects on the panel to bounce back and forth as the numbers change, if in vertical dock they cause the dock to expand/shrink in size horizontally.

Thoughts for label improvements:

  • They should probably have a fixed size allowing for enough room and right justify within?
  • If a fixed size/length is set would that cause problems with different fonts?
  • It would be nice if the length could be measured at runtime and each label could grow but never shrink.
  • labels on horizontal panels could have room for full bitrate "Mbps" and on vetical panels still the short version.
@CarsonBurke
Copy link
Contributor

CarsonBurke commented Mar 13, 2025

Forcing a monospace font would help. Then we just have to make sure there are always the same decimals.

I'm not sure how to do the "grow but don't shrink" that you're describing, it might not be possible yet.

@iamkartiknayak
Copy link

Forcing a monospace font would help

Better approach would be to use fixed width. Forcing a font would take the customization aspect of font away

@CarsonBurke
Copy link
Contributor

As I said, I don't know of a way to do fixed width in the way that we want it. If you know how, please share.
To expand, a simple fixed width does not account for variable font size and will look strange unless we get it exact. We need a psuedo-dynamic way, where it only grows to fit new content and does not shrink afterwards.

As for customization, users can choose which system-wide monospace font they want to use, and we can use that. If absolutely necessary, we can add a setting to configure the font.

@iamkartiknayak
Copy link

If COSMIC developers are able to fix it

pop-os/cosmic-applets#856

@CarsonBurke
Copy link
Contributor

Seems like we will have to use a custom iced widget to accomplish this.

@Hyperchaotic
Copy link
Collaborator Author

More thoughts:

I tried monospace one time, as I recall they take up much more width which wasn't nice.

I think for now easiest is to set a fixed width size for the labels scaled to fit the font size, with a few extra pixels of space and right justify the text inside, so the text can grow/shrink but the label won't. Then we can either accept that non-default font might look messier or we could force Open Sans so the numbers are guaranteed.

Might need two labels one for the network arrow and one for the text, so the arrows stay in place?

@CarsonBurke
Copy link
Contributor

So long as the text is aligned left I think it can all be in one text widget

I take back what I said about monospace, I didn't realize before that the letters are not shifting it, but instead the variance in digits. The default font seems fine, unless I'm using a different font from you and we're having different experiences?

@Hyperchaotic
Copy link
Collaborator Author

The individual characters also have different width so do cause a tiny bit of wobble, though less than variance of digits.

Yeah we can base width on Open Sans, if the user chooses another system font it may work or wobble a bit but it’s solution for now.

@CarsonBurke
Copy link
Contributor

Ohh I am using Open Sans, that would explain why I am not seeing any wobble lol.

Whatever you think is best

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants