Skip to content

Increase width of bandwidth and frequency indicators - #543

Open
vjr wants to merge 8 commits into
mainfrom
vishal/indicator-widths
Open

vjr wants to merge 8 commits into
mainfrom
vishal/indicator-widths

Conversation

@vjr

@vjr vjr commented Aug 25, 2026

Copy link
Copy Markdown
Member

Avoid indicator positions shifting when displaying different values.

Refer:
elementary/sideload#115
elementary/panel-datetime#246

Avoid indicator positions shifting when displaying different values.
@vjr vjr self-assigned this Aug 25, 2026
@vjr
vjr requested review from a team and stsdc August 25, 2026 03:37
@vjr vjr mentioned this pull request Aug 25, 2026
@vjr
vjr requested a review from danirabbit August 25, 2026 03:50

@danirabbit danirabbit left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of doing this we should use tabular numbers. There's a built-in style class for it in Granite https://github.com/elementary/granite/blob/c4f258db9b6028c8b793f01d2f8248800726ce0a/lib/Constants.vala#L269

@vjr

vjr commented Aug 25, 2026

Copy link
Copy Markdown
Member Author

Instead of doing this we should use tabular numbers. There's a built-in style class for it in Granite https://github.com/elementary/granite/blob/c4f258db9b6028c8b793f01d2f8248800726ce0a/lib/Constants.vala#L269

I'm unable to get this working. Seems to need to set width_chars (and maybe even max_width_chars) on the labels regardless.

I've done the following in my local changes:

  • Added dependency('granite-9', version: '>=9.0.0') to meson.build files.
  • Called Granite.init (); in the Indicator.vala construct block.
  • Called label.add_css_class (Granite.CssClass.NUMERIC); in the base IndicatorWidget.vala class.

The labels still resize depending on the unit text length like "bytes" or "MB" and the numbers don't seem to appear monospace, what am I missing? Halp!

@vjr
vjr requested a review from danirabbit August 25, 2026 06:30
@vjr

vjr commented Aug 25, 2026

Copy link
Copy Markdown
Member Author

I wonder if it's just OS9 being OS9 (something missing in the daily build) at the moment? Let me try real quick on my OS8 daily installation.

@vjr

vjr commented Aug 25, 2026

Copy link
Copy Markdown
Member Author

I wonder if it's just OS9 being OS9 (something missing in the daily build) at the moment? Let me try real quick on my OS8 daily installation.

Ah nevermind, it needs OS9 wingpanel-9 lib, so my status is still: Halp!

@stsdc

stsdc commented Aug 25, 2026

Copy link
Copy Markdown
Member

@vjr search for tabular number in the codevase. I think I've used them in the statusbar widget.

@danirabbit

Copy link
Copy Markdown
Member

You don't need to use Granite 9 (and shouldn't yet!). This feature is available since Granite 7.7.0

@stsdc

stsdc commented Sep 10, 2026

Copy link
Copy Markdown
Member

@vjr did you try width_chars?

@vjr
vjr dismissed danirabbit’s stale review September 14, 2026 06:44

How does it look now? I haven't used granite, just looked at the following:
elementary/panel-datetime#246
elementary/sideload#115

@vjr

vjr commented Sep 14, 2026

Copy link
Copy Markdown
Member Author

@vjr search for tabular number in the codevase. I think I've used them in the statusbar widget.

@stsdc I've used both tabulars and width_chars, how does it look now?

I copied from:
elementary/sideload#115
elementary/panel-datetime#246

@stsdc

stsdc commented Sep 16, 2026

Copy link
Copy Markdown
Member

hi @vjr, please resolve the conflicts :)

@vjr

vjr commented Sep 16, 2026

Copy link
Copy Markdown
Member Author

hi @vjr, please resolve the conflicts :)

@stsdc done!

@stsdc

stsdc commented Sep 16, 2026

Copy link
Copy Markdown
Member

Real estate on wingpanel is limited. So I would do as much as possible to minimize its usage.
I remember I was hesitant to add the network values, so I introduces switches. The values constantly switching were too distracting.

image

This is an improvement to when the indicator was jumping, but still there is a room for more:
image

What if we move from bits/s → b/s, then we can allocate just 3 characters for the unit name. Then, we can allocate 4 or 5 characters for the numeric value. To avoid leaving the space unused, we can assure to always use 3 characters for the unit name by making "kb/s" the lowest prefix.

Otherwise, we can assure that unit name stays always at the end and is not impacted by the changed value.

@vjr

vjr commented Sep 16, 2026

Copy link
Copy Markdown
Member Author

@stsdc you observed the contents (formatted speed string) of the indicator shifting around based on changing values and units, but if you see the icon (up/down arrows and the fixed width_chars) the entire indicator does not shift, meaning it does not cause the other indicators to the left of them (like cpu/gpu/ram etc) they do not shift so the effect is much less jarring.

But yes, the text within the speed indicators still shift around, is there a way for me to provide custom widgets within the wingpanel indicator DisplayWidget item, if so, I can try to further reduce/fix the shifting around of the contents?

Thanks!

@vjr

vjr commented Sep 16, 2026

Copy link
Copy Markdown
Member Author

Real estate on wingpanel is limited. So I would do as much as possible to minimize its usage.
I remember I was hesitant to add the network values, so I introduces switches. The values constantly switching were too distracting.

hi @stsdc i have tried my best to minimise the indicators shifting about and wasted spacing in 005b984 please take a look and let me know what you think?

if i try the tabular number markup or monospace style the size of the text/numbers shrinks and im unable to clean that up.

this is the best i can do lol, but let me know if there's a better approach?

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

Successfully merging this pull request may close these issues.

3 participants