From a4052e2a7b7859db9435056c51b799b9dbf61f58 Mon Sep 17 00:00:00 2001 From: Jon Lund Steffensen Date: Sat, 27 Dec 2014 19:40:49 -0500 Subject: redshift: Add config setting to set gamma separately for day/night These settings are gamma-day and gamma-night. The setting gamma will still override both the daytime and nighttime gamma setting. --- src/redshift.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'src/redshift.c') diff --git a/src/redshift.c b/src/redshift.c index 5f2598e..a19fe5c 100644 --- a/src/redshift.c +++ b/src/redshift.c @@ -797,7 +797,9 @@ main(int argc, char *argv[]) exit(EXIT_FAILURE); } - /* Set night gamma to the same value as day gamma. */ + /* Set night gamma to the same value as day gamma. + To set these to distinct values use the config + file. */ memcpy(night.gamma, day.gamma, sizeof(night.gamma)); break; case 'h': @@ -991,6 +993,28 @@ main(int argc, char *argv[]) memcpy(night.gamma, day.gamma, sizeof(night.gamma)); } + } else if (strcasecmp(setting->name, "gamma-day") == 0) { + if (isnan(day.gamma[0])) { + r = parse_gamma_string(setting->value, + day.gamma); + if (r < 0) { + fputs(_("Malformed gamma" + " setting.\n"), + stderr); + exit(EXIT_FAILURE); + } + } + } else if (strcasecmp(setting->name, "gamma-night") == 0) { + if (isnan(night.gamma[0])) { + r = parse_gamma_string(setting->value, + night.gamma); + if (r < 0) { + fputs(_("Malformed gamma" + " setting.\n"), + stderr); + exit(EXIT_FAILURE); + } + } } else if (strcasecmp(setting->name, "adjustment-method") == 0) { if (method == NULL) { -- cgit v1.2.3-70-g09d2