Skip to content

Address edge case where temp info is reset when brightness goes below 0.0 in delta mode #45

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

Merged
merged 2 commits into from
Jun 26, 2024

Conversation

j-silv
Copy link
Contributor

@j-silv j-silv commented May 12, 2024

Before this commit the temperature would be reset to TEMPERATURE_ZERO if the brightness was reduced to 0.0 in delta mode. Now it resets to TEMPERATURE_NORM. I noticed this because I have a keyboard shortcut which can quickly reduce and increase brightness using the delta mode.

If you want to test it, you can do: xsct 6500 -1; xsct -d 0 1. This results in a red screen, even though it wasn't intended to change the temperature from 6500.

Now the temperature is reset to 6500, which isn't the perfect solution, but at least it's somewhat aligned to passing 0 as a parameter to xsct in absolute mode.

Also add small fix to make sure both temp and brightness are provided when in delta mode.

…mode

This quirk is explained in the README. Basically if the brightness that's passed to
get_sct_for_screen() is less than or equal to zero, the temperature is 'set' to 0.
This means that if we were using delta mode to decrease the brightness, the temperature
information will be lost whenever the brightness becomes less than or equal to 0.

Before this commit, this would manifest itself by forcing the temperature to 700K.
For example, doing `xsct 6500 -1; xsct -d 0 1` would result in a red screen, even though
we didn't intend to change the color temperature.

Ideally, the temperature information should stay the same if we are only shifting the brightness
and we reach 0.0, but I couldn't think of a straightforward way to implement this.

Also add a fix to make sure temp and brightness are included when using the delta flag
@faf0
Copy link
Owner

faf0 commented Jun 25, 2024

Thanks for your contribution, @j-silv ! I think after the suggested changes, this is good to merge.

Copy link
Contributor Author

@j-silv j-silv left a comment

Choose a reason for hiding this comment

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

Suggestions look good

Copy link
Owner

@faf0 faf0 left a comment

Choose a reason for hiding this comment

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

Thank you!

@faf0 faf0 merged commit bfd8680 into faf0:master Jun 26, 2024
1 check 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.

2 participants