Skip to content
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

Use sweep_write when changing brightness #25

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hodgesds
Copy link

This change uses https://docs.rs/blight/latest/blight/struct.Device.html#method.sweep_write for adjusting brightness as well as reusing the Device. This should resolve #12.

This change uses https://docs.rs/blight/latest/blight/struct.Device.html#method.sweep_write
for adjusting brightness as well as reusing the `Device`.

Signed-off-by: Daniel Hodges <[email protected]>
@ErikReider
Copy link
Owner

ErikReider commented Jul 14, 2023

I'll look at this later tonight. Don't be afraid to ping me if I forget :)

Thanks for your patience

Comment on lines -274 to -277
// Limits the lowest brightness to 5%
if change / max < (brightness_delta as f64) * 0.01 {
return Ok(Some(device));
}
Copy link
Owner

Choose a reason for hiding this comment

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

Removing this doesn't limit the brightness to the lower 5%

Comment on lines -281 to +273
match change_bl(brightness_delta, Change::Regular, direction, None) {
match device.sweep_write(change, Delay::default()) {
Copy link
Owner

Choose a reason for hiding this comment

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

The issue with the sweep function is that it's blocking the main thread, i.e. the overlay change gets delayed until the sweep has completed.

Did the change to sweep_write fix #12 or was it the logic above?

Copy link
Author

Choose a reason for hiding this comment

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

I think the logic helps, but it doesn't properly change by the amount for some reason. I think you are probably right about blocking the main thread. I'll play around with it sometime when it bothers me more.

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 --brightness lower doesn't lower brightness
2 participants