Commit Graph
115 Commits
Author SHA1 Message Date
Faheel Ahmad 6d44559b48 Limit lines to 80 chars 2017-07-29 16:36:27 +05:30
Faheel Ahmad 29727a990c Fix #474: Format help text paragraph to 80 chars max 2017-07-27 08:58:22 +05:30
Jon Lund Steffensen d7b7caf990 redshift.c: Use 6500K and 4500K by default 2017-01-08 15:44:58 -05:00
Mattias Andrée e0a617fcad Move signal processing functions and sigaction calls to signals from redshift.c
Signed-off-by: Mattias Andrée <maandree@operamail.com>
2015-12-28 11:31:42 -05:00
Jon Lund Steffensen 5f26b3d396 Merge pull request #197 from forivall/clamp-fix
Fix clamp issues
2015-05-10 20:34:47 -04:00
Mattias Andrée 6954f21fd4 remove unnecessary null-checks, it is safe to pass NULL to free (per documentation)
Signed-off-by: Mattias Andrée <maandree@operamail.com>
2015-05-07 17:52:27 +02:00
Jordan Klassen ba15832b9e Fix CLAMP macro overwritten by glib headers
Fixes #188

When I moved the macro definition below all of the includes, I got the
following compiler warning:

/usr/include/glib-2.0/glib/gmacros.h:246:0: note: this is the location
of the previous definition
 #define CLAMP(x, low, high)  (((x) > (high)) ? (high) : (((x) < (low))
? (low) : (x)))

So, that's the macro definition that was being used whenever "CLAMP" was
used. It's pretty obvious what went wrong.
2015-05-02 12:35:05 -07:00
Jon Lund Steffensen 731a7d2cd5 Fix #162: Ensure that interpolation alpha is in [0;1] 2015-01-15 09:37:31 -05:00
Christian Burger 8dbeda906a fixes jonls/redshift#157 introduced by jonls/redshift@f9c2a1568c 2015-01-10 12:32:04 +01:00
Jon Lund Steffensen 8d5cf30b4d redshift: Add print_location() function 2015-01-04 17:48:10 -05:00
Jon Lund Steffensen 017fc230be redshift: Add gamma_is_valid function to check gamma
This checks whether the gamma values are within the bounds of
MIN_GAMMA and MAX_GAMMA.
2015-01-04 16:32:47 -05:00
Jon Lund Steffensen bb61a25e88 redshift: Add transition scheme type with color settings
This changes the transition_levels_t to transition_scheme_t and
adds two fields day, night of type color_setting_t. This
encapsulates all the information needed to calculate the current
color setting from an elevation.
2015-01-04 16:32:47 -05:00
Jon Lund Steffensen c2f0ca4647 redshift: Make transition levels parameter to related functions
Moves transition_low and transition_high from globals into a
struct transition_levels_t that is created in main and passed to
the relevant functions.
2015-01-04 16:32:47 -05:00
Jon Lund Steffensen f9c2a1568c redshift: Move continual loop mode to separate function 2015-01-04 16:32:47 -05:00
Jon Lund Steffensen 799b08214d Add location_t type with lat/lon fields 2015-01-04 16:32:47 -05:00
Jon Lund Steffensen 0cc785c730 redshift: Add noop pause() macro on windows platform
Build failed on windows platform since pause() is not available. The
function is not needed on the windows platform so we just define a
noop pause() macro.
2015-01-04 14:53:16 -05:00
Jon Lund Steffensen bd086885a5 Fix #152: redshift: Loop in reset/manual/one-shot mode with Quartz
The gamma adjustments made with the Quartz (OSX) method are tied
to the process so when we exit, the gamma adjustments are reset.
Therefore we need to run a loop that breaks on CTRL-C, after the
gamma adjustments are made.
2015-01-04 13:50:53 -05:00
Jon Lund Steffensen 542254705b redshift: Fix untranslated status strings 2014-12-30 22:08:06 -05:00
Jon Lund Steffensen 59023d86f4 Merge branch 'hooks-dir' 2014-12-28 19:26:29 -05:00
Jon Lund Steffensen f154aaa7c1 redshift: Add translation comment on period name None 2014-12-28 14:34:43 -05:00
Jon Lund Steffensen 0b94ec26fe redshift: Add translation of Daytime/Night in new gamma string 2014-12-28 14:34:21 -05:00
Jon Lund Steffensen d281e0c1ed redshift: Add translation comment to N,S,W,E strings 2014-12-28 14:33:11 -05:00
Jon Lund Steffensen ba422bd78e systemtime: Add function wrapping platform sleep function
Adds systemtime_msleep() which sleeps for a number of milliseconds.
This wraps Sleep() on windows and usleep() on other platforms.
2014-12-28 13:13:21 -05:00
Jon Lund Steffensen 159754c1cd redshift: Add hooks for user actions on period switch
Hooks are executable scripts in ~/.config/redshift/hooks/ that
are run when a certain event happens. The first parameter to the
script indicates the event and further parameters may indicate
more details about the event.

The event "period-changed" is indicated when the period changes
("night", "daytime", "transition"). The second parameter is the old
period and the third is the new period. The event is signaled when
Redshift starts up with the old period set to "none".
2014-12-28 01:36:26 -05:00
Jon Lund Steffensen 4a572e85e9 redshift: Move period_t to header 2014-12-28 01:30:35 -05:00
Jon Lund Steffensen d58de55645 redshift: Add enum member for unknown period_t (PERIOD_NONE) 2014-12-28 01:25:10 -05:00
Jon Lund Steffensen 4e7717cf14 redshift: Properly handle errors in sigaction 2014-12-28 01:23:30 -05:00
Jon Lund Steffensen cfe90ccf70 redshift: Fix translation of period names
The static string array period_names contains strings that are printed
but these were not marked for translation. This is fixed now by adding
the _N() macro and calling gettext() when the strings are used.
2014-12-27 23:12:47 -05:00
Jon Lund Steffensen 396ecd69a8 redshift: Only print period information when it changes
This change adds functions to determine what the current period is
so we can keep track and only print the period when it changes.
2014-12-27 21:27:36 -05:00
Jon Lund Steffensen 431780b851 redshift: Be less verbose when color values did not change
This keeps a copy of the previous color_setting_t in the loop so
that we can avoid printing the color temperature and brightness if
they did not change.
2014-12-27 21:26:37 -05:00
Jon Lund Steffensen 6ecbfe324f redshift: Change duration of sleep to macro 2014-12-27 20:46:59 -05:00
Jon Lund Steffensen ec5aa19acf redshift: Simplify set_temperature by passing color_setting_t
Changes all set_temperature function in gamma adjustment methods
to take a color_setting_t pointer with the color settings.

Colorramp functions are similarly changed to take a color settings
struct.
2014-12-27 20:22:11 -05:00
Jon Lund Steffensen a4052e2a7b 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.
2014-12-27 19:43:05 -05:00
Jon Lund Steffensen 4ac4d9ee2d redshift: Move color settings into struct for period
Move color settings (temperature, gamma and brightness) into a
struct for each period (day, night). Change the interpolation
function to interpolate all values between these structs.
2014-12-27 19:43:05 -05:00
Jon Lund Steffensen c00bcff953 redshift: Use double for interpolation function 2014-12-27 19:30:16 -05:00
Jon Lund Steffensen 8839dcd530 Add CoreLocation (OSX) location provider
Similarly to the Geoclue provider, the CoreLocation provider only
requests the location on startup.
2014-12-15 20:36:35 -05:00
Jon Lund Steffensen 980a993c98 Add Quartz (OSX) gamma adjustment method 2014-12-15 20:31:51 -05:00
Jon Lund Steffensen ee7e91dd86 Fix #80: Add Geoclue2 location provider
This simply runs a GLib main loop when the location is requested
and tries to get the location from GeoClue2. We need to run a
main loop since the location is not immediately available, instead
it becomes available through a signal.
2014-12-15 01:47:49 -05:00
Jon Lund Steffensen 970e9dc624 Fix #105: Limit decimals in displayed location to two 2014-08-16 22:49:41 -04:00
Mattias Andrée 7027488b03 Fix #90: Print N/S and E/W in the location 2014-08-16 22:34:57 -04:00
Mattias Andrée 7d74a6a48c Add support for custom transition start and end elevation
Implemented through config options transition-high and transition-low (there
is no command line switch at this point). Determines at what solar elevation
Redshift will change from night to transition period to day.

Signed-off-by: Mattias Andrée <maandree@operamail.com>
2014-05-07 20:18:00 -04:00
Mattias Andrée ed9186814d Fix #41: Do not jump to 0 % or 100 % when changing direction of transition
Signed-off-by: Mattias Andrée <maandree@operamail.com>
2014-05-07 17:16:13 -04:00
Mattias Andrée 67f479d057 Support for running Redshift without a graphical environment in Linux by using Direct Rendering Manager
Signed-off-by: Mattias Andrée <maandree@operamail.com>
2014-03-22 19:46:11 +01:00
Mattias Andrée b2e2e4831c Free resources from config-ini.c on exit
Signed-off-by: Mattias Andrée <maandree@operamail.com>
2014-03-13 00:29:58 +01:00
Jon Lund Steffensen d007007191 Only start "dummy" gamma method if explicitly requested 2013-12-09 14:32:08 -05:00
Jon Lund Steffensen 79bfe9eed4 Remove Gnome Clock location provider
This was basically a hack that happened to work because the Gnome Clock
applet could store the current location of the user, and Redshift was able
to fetch this location through GConf. Since Redshift for some time now has
supported a config file where the location can be set, there is not really
any reason to use an external, fragile solution to do the same.
2013-12-09 14:07:01 -05:00
Jon Lund Steffensen e4034ba27d Do not allow NULL keys when setting options
This should fix a bug where command line options for the "manual" location
provider cannot override the config file. To keep compatability with previous
versions the command line parser will still special case parsing "-l LAT:LON"
and set the correct options in "manual".
2013-12-09 12:28:45 -05:00
Jon Lund Steffensen 3b61f90b34 When in print mode do not start a gamma method
A gamma method is not needed in print mode
2013-12-09 10:58:43 -05:00
Jon Lund Steffensen 2d4a5ad26b Add dummy gamma adjustment method
This method does not do anything but print the temperature to the terminal.
An external program implementing a color temperature adjustment scheme that
is not supported by redshift can use this method to determine the desired
color temperature. It is also useful for testing other parts of redshift on
systems where neither RandR nor VidMode works.
2013-12-09 10:48:45 -05:00
Jon Lund Steffensen 3297f52f48 Fix newline in help output text 2013-12-08 20:24:27 -05:00