sct

set color temperature
git clone anongit@rnpnr.xyz:sct.git
Log | Files | Refs | Feed | README | LICENSE

Commit: 539ea17dbf29ee1a7904dcb734e92cefc57472ac
Parent: 904682f8a3e14b0015babbd907a29a77e2579f7e
Author: Randy Palamar
Date:   Sun,  2 Apr 2023 21:44:45 -0600

simplify final branch in main()

Diffstat:
Msct.c | 22++++++----------------
1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/sct.c b/sct.c @@ -270,25 +270,15 @@ main(int argc, char **argv) temp.temp, temp.brightness); } } else { - if (!dflag) { - // Set temperature to given value or default for - // a value of 0 - if (temp.temp == 0) - temp.temp = TEMPERATURE_NORM; - for (screen = screen_first; screen <= screen_last; - screen++) - sct_for_screen(screen, crtc_specified, &temp); - } else { - // Delta mode: Shift temperature of each screen - // by given value - for (screen = screen_first; screen <= screen_last; screen++) { - struct temp_status tempd; - tempd.temp = 0; - tempd.brightness = 1.0; + struct temp_status tempd = {.temp = 0, .brightness = 1.0}; + if (!dflag && temp.temp == 0) + temp.temp = TEMPERATURE_NORM; + for (screen = screen_first; screen <= screen_last; screen++) { + if (dflag) { get_sct_for_screen(&tempd, screen, crtc_specified); tempd.temp += temp.temp; - sct_for_screen(screen, crtc_specified, &tempd); } + sct_for_screen(screen, crtc_specified, dflag? &tempd : &temp); } }