Skip to content

Comments

Use better rounded divisions#177

Merged
ErikReider merged 2 commits intoErikReider:mainfrom
gtarsia:main
Oct 26, 2025
Merged

Use better rounded divisions#177
ErikReider merged 2 commits intoErikReider:mainfrom
gtarsia:main

Conversation

@gtarsia
Copy link
Contributor

@gtarsia gtarsia commented Oct 24, 2025

This change makes raising/lowering/setting a percent more consistent.

It fixes #175 where, at certain percents, increasing by 1 causes the brightness to flicker or just get stuck.

It does so by rounding the brightness percent to closest integer.

@gtarsia
Copy link
Contributor Author

gtarsia commented Oct 25, 2025

Ok, renamed div_round to div_round_u32.

I think this is good to go, switching brightness now looks great on my setup.

Btw, I see this warning when changing brightness (which was there before my changes):

(swayosd-server:55525): Gtk-WARNING **: 10:58:59.635: GtkGizmo 0x557ce3f4e9f0 (progress) reported min width -2, but sizes must be >= 0

and, not only I don't understand what's causing it, I couldn't make any quick fixes I found online work, such as:

  • Setting min-width: 0 to progressbar in .config/swayosd/style.css
  • Calling set_size_request (progress_widget, 0, -1) on the progress bar.

@ErikReider
Copy link
Owner

Btw, I see this warning when changing brightness (which was there before my changes):

(swayosd-server:55525): Gtk-WARNING **: 10:58:59.635: GtkGizmo 0x557ce3f4e9f0 (progress) reported min width -2, but sizes must be >= 0

Might be your custom CSS? Not seeing it on my end...

Copy link
Owner

@ErikReider ErikReider left a comment

Choose a reason for hiding this comment

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

LGTM, thanks! :)

@ErikReider ErikReider merged commit 10edcd9 into ErikReider:main Oct 26, 2025
2 checks passed
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.

swayosd-client --brightness raise fails to consistently raise brightness

2 participants