sct

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

Commit: f490e9b178dc37c2005fa0f20ddda3fd8bfb0f0d
Parent: 9387d1d4e2255287f58c9379a0379b703fc53635
Author: Randy Palamar
Date:   Sun,  2 Apr 2023 19:08:58 -0600

remove ssct.h

Diffstat:
Mssct.c | 34++++++++++++++++++++++++++++++++--
Dssct.h | 46----------------------------------------------
2 files changed, 32 insertions(+), 48 deletions(-)

diff --git a/ssct.c b/ssct.c @@ -3,15 +3,45 @@ * * Public domain, do as you wish. */ +#include <math.h> #include <stdarg.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <X11/Xatom.h> +#include <X11/Xlib.h> +#include <X11/Xproto.h> +#include <X11/extensions/Xrandr.h> #include "arg.h" -#include "ssct.h" + +#define TEMPERATURE_NORM 6500 +#define TEMPERATURE_ZERO 700 +#define GAMMA_MULT 65535.0 +// Approximation of the `redshift` table from +// https://github.com/jonls/redshift/blob/master/src/colorramp.c +// without limits: +// GAMMA = K0 + K1 * ln(T - T0) +#define GAMMA_K0GR -1.47751309139817 +#define GAMMA_K1GR 0.28590164772055 +#define GAMMA_K0BR -4.38321650114872 +#define GAMMA_K1BR 0.6212158769447 +#define GAMMA_K0RB 1.75390204039018 +#define GAMMA_K1RB -0.1150805671482 +#define GAMMA_K0GB 1.49221604915144 +#define GAMMA_K1GB -0.07513509588921 +#define BRIGHTHESS_DIV 65470.988 +#define DELTA_MIN -1000000 static Display *dpy; static int vflag; char *argv0; +struct temp_status { + int temp; + double brightness; +}; + static void die(const char *errstr, ...) { @@ -276,5 +306,5 @@ main(int argc, char **argv) XCloseDisplay(dpy); - return EXIT_SUCCESS; + return 0; } diff --git a/ssct.h b/ssct.h @@ -1,46 +0,0 @@ -/* - * xsct - X11 set color temperature - * - * Public domain, do as you wish. - */ - -#include <X11/Xatom.h> -#include <X11/Xlib.h> -#include <X11/Xproto.h> -#include <X11/extensions/Xrandr.h> - -#include <math.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#define XSCT_VERSION "1.9" - -#define TEMPERATURE_NORM 6500 -#define TEMPERATURE_ZERO 700 -#define GAMMA_MULT 65535.0 -// Approximation of the `redshift` table from -// https://github.com/jonls/redshift/blob/04760afe31bff5b26cf18fe51606e7bdeac15504/src/colorramp.c#L30-L273 -// without limits: -// GAMMA = K0 + K1 * ln(T - T0) -// Red range (T0 = TEMPERATURE_ZERO) -// Green color -#define GAMMA_K0GR -1.47751309139817 -#define GAMMA_K1GR 0.28590164772055 -// Blue color -#define GAMMA_K0BR -4.38321650114872 -#define GAMMA_K1BR 0.6212158769447 -// Blue range (T0 = TEMPERATURE_NORM - TEMPERATURE_ZERO) -// Red color -#define GAMMA_K0RB 1.75390204039018 -#define GAMMA_K1RB -0.1150805671482 -// Green color -#define GAMMA_K0GB 1.49221604915144 -#define GAMMA_K1GB -0.07513509588921 -#define BRIGHTHESS_DIV 65470.988 -#define DELTA_MIN -1000000 - -struct temp_status { - int temp; - double brightness; -};