aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJon Lund Steffensen <jonlst@gmail.com>2014-12-27 19:40:49 -0500
committerJon Lund Steffensen <jonlst@gmail.com>2014-12-27 19:43:05 -0500
commita4052e2a7b7859db9435056c51b799b9dbf61f58 (patch)
tree3fb715575c0b746bd7583d8fabeba6cbad24e91f /src
parentredshift: Move color settings into struct for period (diff)
downloadredshift-ng-a4052e2a7b7859db9435056c51b799b9dbf61f58.tar.gz
redshift-ng-a4052e2a7b7859db9435056c51b799b9dbf61f58.tar.bz2
redshift-ng-a4052e2a7b7859db9435056c51b799b9dbf61f58.tar.xz
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.
Diffstat (limited to 'src')
-rw-r--r--src/redshift.c26
1 files changed, 25 insertions, 1 deletions
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) {