Git Product home page Git Product logo

jonls / redshift Goto Github PK

View Code? Open in Web Editor NEW
5.8K 98.0 422.0 2.09 MB

Redshift adjusts the color temperature of your screen according to your surroundings. This may help your eyes hurt less if you are working in front of the screen at night.

Home Page: http://jonls.dk/redshift

License: GNU General Public License v3.0

Shell 0.07% C 73.91% Objective-C 3.27% Python 11.79% Makefile 2.93% M4 4.95% Roff 3.09%
color-temperature redshift gamma-ramps night-mode night eye-strain

redshift's Introduction

Redshift

Redshift adjusts the color temperature of your screen according to your surroundings. This may help your eyes hurt less if you are working in front of the screen at night.

README versions: latest | 1.12 | 1.11

Redshift logo

Run redshift -h for help on command line options. You can run the program as redshift-gtk instead of redshift for a graphical status icon.

Build status

Build Status Build Status

Technical Details (Gamma Ramps)

Redshift applies a redness effect to the graphical display. The intensity of the redness can be customized and scheduled to only be applied at night or to be applied with more intensity at night.

Redshift uses the gamma correction ramps to apply this effect which has traditionally been the only way of applying a color effect to the display. Note that this is really a hack to work around the absense of a standardized way of applying color effects, and it is resulting in several issues some of which are explained in the FAQ section below. As long as Redshift is using gamma ramps, many of these issues are impossible to solve properly in Redshift.

Since Redshift was first created, many desktop environments have adopted similar functionality as an integrated component:

Using the features integrated into the desktop environments avoids many of the issues with gamma ramps which is why these implementations should generally be favored over Redshift. On the other hand, Redshift may offer some additional flexibility that is not available in the integrated features.

FAQ

How do I install Redshift?

Use the packages provided by your distribution, e.g. for Ubuntu: apt-get install redshift or apt-get install redshift-gtk. For developers, please see Building from source and Latest builds from master branch below.

How do I setup a configuration file?

A configuration file is not required but is useful for saving custom configurations and manually defining the location in case of issues with the automatic location provider. An example configuration can be found in redshift.conf.sample.

The configuration file should be saved in the following location depending on the platform:

  • Linux/macOS: ~/.config/redshift/redshift.conf (if the environment variable XDG_CONFIG_HOME is undefined) or ${XDG_CONFIG_HOME}/redshift/redshift.conf (if XDG_CONFIG_HOME is defined).
  • Windows: Put redshift.conf in %USERPROFILE%\AppData\Local\ (aka %localappdata%).

Where can I find my coordinates to put in the configuration file?

There are multiple web sites that provide coordinates for map locations, for example clicking anywhere on Google Maps will bring up a box with the coordinates. Remember that longitudes in the western hemisphere (e.g. the Americas) must be provided to Redshift as negative numbers.

Why does GeoClue fail with access denied error?

It is possible that the location services have been disabled completely. The check for this case varies by desktop environment. For example, in GNOME the location services can be toggled in Settings > Privacy > Location Services.

If this is not the case, it is possible that Redshift has been improperly installed or not been given the required permissions to obtain location updates from a system administrator. See #318 for further discussion on this issue.

Why doesn't Redshift work on my Chromebook/Raspberry Pi?

Certain video drivers do not support adjustable gamma ramps. In some cases Redshift will fail with an error message, but other drivers silently ignore adjustments to the gamma ramp.

Why doesn't Redshift change the backlight when I use the brightness option?

Redshift has a brightness adjustment setting but it does not work the way most people might expect. In fact it is a fake brightness adjustment obtained by manipulating the gamma ramps which means that it does not reduce the backlight of the screen. Preferably only use it if your normal backlight adjustment is too coarse-grained.

Why doesn't Redshift work on Wayland (e.g. Fedora 25)?

The Wayland protocol does not support Redshift. There is currently no way for Redshift to adjust the color temperature in Wayland.

Instead, you can use:

  • In GNOME Shell: Settings → Display Settings → Night Light
  • In Plasma: System Settings → Display and Monitor → Night Color

Why doesn't Redshift work on Ubuntu with Mir enabled?

Mir does not support Redshift.

When running as a systemd service, redshift fails to connect to the graphical environment

You need to export your environment variables when your window manager or compositor start up. Typically, you want to run this as part of its startup:

systemctl --user import-environment; systemctl --user start graphical-session.target

See your compositor's (or window manager's) documentation for further details of setting up the systemd user session.

Related issues: #753.

The redness effect is applied during the day instead of at night. Why?

This usually happens to users in America when the longitude has been set in the configuration file to a positive number. Longitudes in the western hemisphere should be provided as negative numbers (e.g. New York City is at approximately latitude/longitude 41, -74).

Why does the redness effect occasionally switch off for a few seconds?

Redshift uses the gamma ramps of the graphics driver to apply the redness effect but Redshift cannot block other applications from also changing the gamma ramps. Some applications (particularly games and video players) will reset the gamma ramps. After a few seconds Redshift will kick in again. There is no way for Redshift to prevent this from happening.

Why does the redness effect continuously flicker?

You may have multiple instances of Redshift running simultaneously. Make sure that only one instance is running for the display where you are seeing the flicker.

Why doesn't Redshift change the color of the mouse cursor?

Mouse cursors are usually handled separately by the graphics hardware and is not affected by gamma ramps. Some graphics drivers can be configured to use software cursors instead.

I have an issue with Redshift but it was not mentioned in this FAQ. What do I do?

Please go to the issue tracker and check if your issue has already been reported. If not, please open a new issue describing you problem.

Latest builds from master branch

Contributing / Building from source

See the file CONTRIBUTING for more details.

redshift's People

Contributors

afrantzis avatar anarky avatar andrewsomething avatar ariasuni avatar arnej avatar ava57r avatar bebehei avatar benvdh avatar bigon avatar christian-burger avatar clefebvre avatar fabiobeneditto avatar faheel avatar forivall avatar genodeftest avatar hdevalence avatar janderssonse avatar javiercantero avatar joehillen avatar jonls avatar jubalh avatar kakurasan avatar kcchouette avatar khink avatar maandree avatar maksverver avatar manuc66 avatar phihag avatar tingping avatar whynothugo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

redshift's Issues

Can't specify individual monitor

Hi! Sorry if this is an inappropriate place to ask this, but I can't seem to target a particular monitor when running Redshift.

Here's my setup:

  • HDMI-1 (in xrandr) is my main monitor. I'd like to run redshift on it.
  • DVI-I-1 (in xrandr) is my secondary monitor used for media. I'd like not to run redshift on this one, since it's for watching movies.

They're set up on the same X screen, :0. I use awesome window manager to treat the monitors as separate screens.

I can interact with the monitors using xrandr just fine. I use xrandr to set up their display resolutions and relative positions with no problem.

However, running gtk-redshift (v1.7), I can't seem to get the shift on just HDMI-1.

All of these commands turn on redshift on both monitors:

  • $ gtk-redshift -l 40.6:-74 -m randr:screen=HDMI-1
  • $ gtk-redshift -l 40.6:-74 -m randr:screen=DVI-I-1
  • $ gtk-redshift -l 40.6:-74 -m randr:screen=0

And, as one might expect, this is the output of -m randr:screen=1:

$ gtk-redshift -l 40.6:-74 -m randr:screen=1
Screen 1 could not be found.
Failed to start adjustment method randr.

Must I set up a separate X screen to run Redshift only on HDMI-1? What am I missing?

Thanks for a wonderful piece of software!

Selection -m option delimiter

Currently : delimits options in -m and -l and = delimits the option name and its associated value.
Problems we are facing with this:

  • : delimits the hostname and the display index in the display name of an X display. in #61 -m randr and -m vidmode have been extended to support selecting display. Additionally, : long with [ and ] are required for IPv6 address which can be used instead of a hostname.
  • : is used in to separate values for red, green and blue and gamma settings. If redshift is extended to support using multiple adjustment methods concurrently it will be sensible to support using -m multiple times, and thus it will make since to specify the gamma correction for each monitor in -m.
  • , is used to delimit CRTC:s in #81 while allows the user to specify multiple CRTC:s in one -m. This feature should also be added the screen option and the display option offered by #61.
  • , is not too good of an alternative as it could be used instead of . in floating point values.
  • The are serve other character that are not too good options either because they have special meaning for shells and have to be escaped or put in qoutes. This includes symbols such as ; and &.

So the question is, how should options be delimited in -m and -l?

Add different gamma settings for day and night

It will be very useful to be able to distinct gamma settings according to changing day and night. In night preset with low brightness factor, gamma tuning increase readability while in day preset it is not necessary anymore.

Remove brightness limitation

I cannot see any reason why the upper limit for brightness is set at 1,0, and I think it should be removed because it is (I beleave) an artifical limitation without reason, other than perhaps that colours start to look wrong above 1,0. Sure you would probably not combine decreasing the colour temperature with extra brightness. However, (1) redshift supports making the screen bluer rather than reder and in that case you might prefer that and (2) you may want to use redshift instead of xrandr (or wantever) to configure gamma and brightness as you would also be able to configure temperature.

redshift not working properly on mouse pointers

Redshift is not working properly on mouse pointers. They are still bright....

Distro:
Linux version 3.8.0-19-generic (buildd@allspice) (gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-1ubuntu1) ) #29-Ubuntu SMP Wed Apr 17 18:16:28 UTC 2013 (Ubuntu 3.8.0-19.29-generic 3.8.8)

redshift 1.7

Geoclue error

$ redshift list
Trying location provider `geoclue'...
Unable to obtain master client: Process org.freedesktop.Geoclue.Master exited with status 127
Failed to start provider geoclue.

Same with both geoclue 0.12.99 and 2.0.0. dbus 1.8.0. kernel 3.13.6
Verbose output doesn't give any additional information.
Please let me know if i provide run strace output.

redshift-gtk decorations

The info-dialog for redshift-gtk suffers those client-side decorations as seen in GNOME. Is it possible to switch to "server-side" decorations, perferably with opt-in (or opt-out) to client-side?

DRM method: "open: No such file or directory"

Hi there,

I'm trying to get redshift to work on my desktop running AMD catalyst drivers, but it's not working:

λ ruby-2.1.0 →  orion app_playbooks → λ git master* → redshift -m drm -l 55.84:-4.25 
open: No such file or directory
Failed to start adjustment method drm.
Section "ServerLayout"
    Identifier     "aticonfig Layout"
    Screen      0  "aticonfig-Screen[0]-0" 1920 0
    Screen         "aticonfig-Screen[0]-1" 0 0
EndSection

Section "Module"
EndSection

Section "ServerFlags"
    Option      "Xinerama" "on"
EndSection

Section "Monitor"
    Identifier   "aticonfig-Monitor[0]-0"
    Option      "VendorName" "ATI Proprietary Driver"
    Option      "ModelName" "Generic Autodetecting Monitor"
    Option      "DPMS" "true"
EndSection

Section "Monitor"
    Identifier   "aticonfig-Monitor[0]-1"
    Option      "VendorName" "ATI Proprietary Driver"
    Option      "ModelName" "Generic Autodetecting Monitor"
    Option      "DPMS" "true"
EndSection

Section "Monitor"
    Identifier   "0-DFP1"
    Option      "VendorName" "ATI Proprietary Driver"
    Option      "ModelName" "Generic Autodetecting Monitor"
    Option      "DPMS" "true"
    Option      "PreferredMode" "1920x1200"
    Option      "TargetRefresh" "60"
    Option      "Position" "0 0"
    Option      "Rotate" "normal"
    Option      "Disable" "false"
EndSection

Section "Monitor"
    Identifier   "0-DFP5"
    Option      "VendorName" "ATI Proprietary Driver"
    Option      "ModelName" "Generic Autodetecting Monitor"
    Option      "DPMS" "true"
    Option      "PreferredMode" "1920x1200"
    Option      "TargetRefresh" "60"
    Option      "Position" "0 0"
    Option      "Rotate" "normal"
    Option      "Disable" "false"
EndSection

Section "Device"
    Identifier  "aticonfig-Device[0]-0"
    Driver      "fglrx"
    Option      "Monitor-DFP1" "0-DFP1"
    BusID       "PCI:1:0:0"
EndSection

Section "Device"
    Identifier  "aticonfig-Device[0]-1"
    Driver      "fglrx"
    Option      "Monitor-DFP5" "0-DFP5"
    BusID       "PCI:1:0:0"
    Screen      1
EndSection

Section "Screen"
    Identifier "aticonfig-Screen[0]-0"
    Device     "aticonfig-Device[0]-0"
    DefaultDepth     24
    SubSection "Display"
        Viewport   0 0
        Depth     24
    EndSubSection
EndSection

Section "Screen"
    Identifier "aticonfig-Screen[0]-1"
    Device     "aticonfig-Device[0]-1"
    DefaultDepth     24
    SubSection "Display"
        Viewport   0 0
        Depth     24
    EndSubSection
EndSection

As you can probably tell from the xorg.conf file, I've got two monitors. I'm running from a Radeon HD 7950. Running redshift with the default mode works for the first screen, but not for the second.

Patch to add a location provider from google wifi database

Below patch added a location provider via google database.

Acctually, from geoclue 2.0, it also provide location infomation via google database and a website hosted at fedora project(with more infomation such as city)

I think the geoclud codes in redshift can be removed in future, since this low level utility really had no need to depend on such a dbus service.

diff -Nur redshift-1.8/configure.ac redshift-1.8.new/configure.ac
--- redshift-1.8/configure.ac   2013-12-11 12:04:43.000000000 +0800
+++ redshift-1.8.new/configure.ac   2013-12-17 14:36:34.406398936 +0800
@@ -25,6 +25,8 @@
 PKG_CHECK_MODULES([GLIB], [glib-2.0 gobject-2.0], [have_glib=yes], [have_glib=no])
 PKG_CHECK_MODULES([GCONF], [gconf-2.0], [have_gconf=yes], [have_gconf=no])
 PKG_CHECK_MODULES([GEOCLUE], [geoclue], [have_geoclue=yes], [have_geoclue=no])
+PKG_CHECK_MODULES([JSONC], [json-c], [have_jsonc=yes], [have_jsonc=no])
+PKG_CHECK_MODULES([CURL], [libcurl], [have_curl=yes], [have_curl=no])

 AC_CHECK_HEADER([windows.h], [have_windows_h=yes], [have_windows_h=no])

@@ -156,6 +158,30 @@
 ])
 AM_CONDITIONAL([ENABLE_GEOCLUE], [test "x$enable_geoclue" = xyes])

+# Check Json-C
+AC_MSG_CHECKING([whether to enable google location provider])
+AC_ARG_ENABLE([google], [AC_HELP_STRING([--enable-google],
+    [enable Google location provider])],
+    [enable_google=$enableval],[enable_google=maybe])
+AS_IF([test "x$enable_google" != xno], [
+    AS_IF([test "x$have_jsonc" = "xyes" -a "x$have_curl" = xyes], [
+        AC_DEFINE([ENABLE_GOOGLE], 1,
+            [Define to 1 to enable Google location provider])
+        AC_MSG_RESULT([yes])
+        enable_google=yes
+    ], [
+        AC_MSG_RESULT([missing dependencies])
+        AS_IF([test "x$enable_google" = xyes], [
+            AC_MSG_ERROR([missing dependencies for Google location provider])
+        ])
+        enable_google=no
+    ])
+], [
+    AC_MSG_RESULT([no])
+    enable_google=no
+])
+AM_CONDITIONAL([ENABLE_GOOGLE], [test "x$enable_google" = xyes])
+

 # Check for GUI status icon
 AC_MSG_CHECKING([whether to enable GUI status icon])
@@ -225,6 +251,7 @@
     Location providers:
     GNOME Clock:   ${enable_gnome_clock}
     Geoclue:       ${enable_geoclue}
+    Google:        ${enable_google}

     GUI:       ${enable_gui}
     Ubuntu icons:  ${enable_ubuntu}
diff -Nur redshift-1.8/src/location-google.c redshift-1.8.new/src/location-google.c
--- redshift-1.8/src/location-google.c  1970-01-01 08:00:00.000000000 +0800
+++ redshift-1.8.new/src/location-google.c  2013-12-17 14:36:13.570398624 +0800
@@ -0,0 +1,100 @@
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <curl/curl.h>
+#include <json.h>
+
+#include "location-google.h"
+
+#ifdef ENABLE_NLS
+# include <libintl.h>
+# define _(s) gettext(s)
+#else
+# define _(s) s
+#endif
+
+
+int
+location_google_init(location_google_state_t *state)
+{
+   return 0;
+}
+
+int
+location_google_start(location_google_state_t *state)
+{
+   return 0;
+}
+
+void
+location_google_free(location_google_state_t *state)
+{
+}
+
+void
+location_google_print_help(FILE *f)
+{
+   fputs(_("Use the location from google.\n"), f);
+}
+
+int
+location_google_set_option(location_google_state_t *state,
+               const char *key, const char *value)
+{
+   return 0;
+}
+
+static size_t 
+write_data(void *ptr, size_t size, size_t nmemb, void *stream)
+{
+    strncat(stream, (char *)ptr, size*nmemb);
+    return size*nmemb;
+}
+
+int
+location_google_get_location(location_google_state_t *state,
+                 float *lat, float *lon)
+{
+  char jsonstr[1024];
+  bzero(&jsonstr, 1024);
+
+  CURL *curl;
+  CURLcode res;
+  curl = curl_easy_init();
+
+  if(curl) {
+    curl_easy_setopt(curl, CURLOPT_URL, "https://maps.googleapis.com/maps/api/browserlocation/json?browser=firefox&sensor=true");
+    curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
+    curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
+    curl_easy_setopt(curl, CURLOPT_WRITEDATA, &jsonstr);
+    res = curl_easy_perform(curl);
+    curl_easy_cleanup(curl);
+    if(res != CURLE_OK) 
+        return -1;
+  } else
+    return -1;
+  //parse it with json-c.
+  //the api design of json-glib is totally fucked up.
+  struct json_object *root, *status, *location, *lato, *lngo;
+
+  root = json_tokener_parse(jsonstr);
+  if (is_error(root))
+     return -1;
+
+  status = json_object_object_get(root, "status");
+  location= json_object_object_get(root, "location");
+  if(status == NULL || location == NULL || strcmp(json_object_get_string(status), "OK"))
+    return -1;
+  lato = json_object_object_get(location, "lat");
+  lngo = json_object_object_get(location, "lng");
+
+  if (!lato || !lngo) {
+    json_object_put(root);
+    return -1;
+  }
+  *lat =  json_object_get_double(lato);
+  *lon =  json_object_get_double(lngo);
+  json_object_put(root);
+  return 0;
+}
diff -Nur redshift-1.8/src/location-google.h redshift-1.8.new/src/location-google.h
--- redshift-1.8/src/location-google.h  1970-01-01 08:00:00.000000000 +0800
+++ redshift-1.8.new/src/location-google.h  2013-12-17 14:38:58.590401100 +0800
@@ -0,0 +1,29 @@
+/* location-google.h
+   get location via Google location service
+   https://maps.googleapis.com/maps/api/browserlocation/json?browser=firefox&sensor=true
+   Acctually, There is no need to use geoclue anymore. from 2.0 version, geoclue also provide location information via google wifi database.
+   Copyright (c) 2013  Cjacker <[email protected]>
+*/
+
+#ifndef _REDSHIFT_LOCATION_GOOGLE_H
+#define _REDSHIFT_LOCATION_GOOGLE_H
+
+#include <stdio.h>
+
+typedef struct {
+    int _unused;
+} location_google_state_t;
+
+int location_google_init(location_google_state_t *state);
+int location_google_start(location_google_state_t *state);
+void location_google_free(location_google_state_t *state);
+
+void location_google_print_help(FILE *f);
+int location_google_set_option(location_google_state_t *state,
+               const char *key, const char *value);
+
+int location_google_get_location(location_google_state_t *state,
+                 float *lat, float *lon);
+
+
+#endif
diff -Nur redshift-1.8/src/Makefile.am redshift-1.8.new/src/Makefile.am
--- redshift-1.8/src/Makefile.am    2013-12-11 12:04:43.000000000 +0800
+++ redshift-1.8.new/src/Makefile.am    2013-12-17 14:36:27.403398831 +0800
@@ -21,7 +21,8 @@
    gamma-vidmode.c gamma-vidmode.h \
    gamma-w32gdi.c gamma-w32gdi.h \
    location-gnome-clock.c location-gnome-clock.h \
-   location-geoclue.c location-geoclue.h
+   location-geoclue.c location-geoclue.h \
+   location-google.c location-google.h

 AM_CFLAGS =
 redshift_LDADD = @LIBINTL@
@@ -62,3 +63,10 @@
 redshift_LDADD += \
    $(GEOCLUE_LIBS) $(GEOCLUE_CFLAGS)
 endif
+
+if ENABLE_GOOGLE
+redshift_SOURCES += location-google.c location-google.h
+AM_CFLAGS += $(JSONC_CFLAGS) $(CURL_CFLAGS)
+redshift_LDADD += \
+   $(JSONC_LIBS) $(CURL_LIBS)
+endif
diff -Nur redshift-1.8/src/redshift.c redshift-1.8.new/src/redshift.c
--- redshift-1.8/src/redshift.c 2013-12-11 12:04:43.000000000 +0800
+++ redshift-1.8.new/src/redshift.c 2013-12-17 14:36:23.420398771 +0800
@@ -80,6 +80,10 @@
 # include "location-geoclue.h"
 #endif

+#ifdef ENABLE_GOOGLE
+# include "location-google.h"
+#endif
+

 /* Union of state data for gamma adjustment methods */
 typedef union {
@@ -146,6 +150,9 @@
 #ifdef ENABLE_GEOCLUE
    location_geoclue_state_t geoclue;
 #endif
+#ifdef ENABLE_GOOGLE
+   location_google_state_t google;
+#endif
 } location_state_t;


@@ -165,6 +172,20 @@
        location_geoclue_get_location
    },
 #endif
+#ifdef ENABLE_GOOGLE
+    {
+        "google",
+        (location_provider_init_func *)location_google_init,
+        (location_provider_start_func *)location_google_start,
+        (location_provider_free_func *)location_google_free,
+        (location_provider_print_help_func *)
+        location_google_print_help,
+        (location_provider_set_option_func *)
+        location_google_set_option,
+        (location_provider_get_location_func *)
+        location_google_get_location
+    },
+#endif
 #ifdef ENABLE_GNOME_CLOCK
    {
        "gnome-clock",

be less verbose when verbose (for logging)

I like to keep logs of what redshift is doing, so I run it with -v, redirecting the output to a file. But it's just way too verbose. This patch (https://gist.github.com/vuvova/2024317db7b211c9fd3c) contains three distinct changes that help for such a use case:

  1. it increases the sleep time from 5 sec to 5 min after every adjustment that didn't change the temperature (most of the time, that is)
  2. it makes -v not to print "Daytime", etc and the new temperature when they're the same as the previous time (when the temperature didn't change). As usual specifying -v twice (-v -v) gives more verbosity, that is — restores the old behavior, printing the temperature always.
  3. It disables output buffering for stdout (otherwise the log becomes pretty useless).
    The patch is for 1.7

Make: fatal error

Dear all,

I am trying to install the newest version of Redshift unsuccessfully:(

From Git I get error message after make command:

gamma-randr.h:26:21: fatal error: xcb/xcb.h: No such file or directory
compilation terminated

Here is the end of configure:

redshift 1.8

prefix:     /usr/local
compiler:       gcc -std=gnu99
cflags:     -g -O2
ldflags:        

Adjustment methods:
RANDR:      no
VidMode:        no
WinGDI:     no

Location providers:
Geoclue:        no

GUI:        yes
Ubuntu icons:   no

I ve tried to install the 1.8 version before from Launcpad but there the error message comes at configure command:

checking whether to enable RANDR method... missing dependencies
checking whether to enable VidMode method... missing dependencies
checking whether to enable WinGDI method... missing dependencies
configure: error: either RANDR, VidMode or WinGDI must be enabled

I guess I have problem w/depedencies or configure (or both). It is very strange (for me:) since I ve got some of the dependencies. For example libxcb-xv0, libxcb-randr0, etc on my computer. Unfortunately I cannot complie the libxcb on my computer since I ve got there also an error:(((

Please help me:)))

thx in advance

Whitelist for certain apps

This would be pretty good for when your watching movies or using applications where colour accuracy is important. The idea being redshift has a list of apps when these are open and/or focused the daytime colour temp is restored temporarily.

Fallback location provider to time zone

Simple as date +%z. Should be relatively easy to guess longitude. It should also be possible to use day-month to detect season and use this. Not sure if this should be part of redshift, probably one of the offline providers may already give that information.

redshift 1.7: Unable to get location from provider.

Sometimes, starting redshift, i receive the following error that prevents redshift to start

** (process:31477): WARNING **: Metadata for error domain "geoclue-error-quark" already registered

Started Geoclue provider `Geoclue Master'.
Using provider `geoclue'.
Could not get location (3 retries left): Geoclue master client has no usable Position providers.
Unable to get location from provider.

No indicator in system tray?

Hey,

Great program but there is no app indicator being spawned in the system tray?

Using Ubuntu 14.04:

ikt@ikt-desktop:~$ sudo apt-cache show redshift
[sudo] password for ikt:
Package: redshift
Priority: extra
Section: universe/x11
Installed-Size: 361
Maintainer: Ubuntu Developers [email protected]
Original-Maintainer: Franziska Lichtblau [email protected]
Architecture: amd64
Version: 1.8-0ubuntu5
Depends: gconf-service, libc6 (>= 2.17), libgconf-2-4 (>= 2.31.1), libgeoclue0 (>= 0.11.1), libglib2.0-0 (>= 2.12.0), libx11-6, libxcb-randr0 (>= 1.3), libxcb1, libxxf86vm1, geoclue-hostip
Filename: pool/universe/r/redshift/redshift_1.8-0ubuntu5_amd64.deb
Size: 54498
MD5sum: 80bbf70a1d0cff9e28fc23a7561fcb38
SHA1: f9e26243913e0c50f9360a7d478d6011225e00d2
SHA256: 742f1e6e78ec9a843d4897ad0708825f4ecda19a6f7532e3e5a9eed4c233236d
Description-en_AU: Adjusts the color temperature of your screen
The color temperature is set according to the position of the sun. A
different color temperature is set during night and daytime. During
twilight and early morning, the color temperature transitions smoothly
from night to daytime temperature to allow your eyes to slowly adapt.
.
This package provides the base program.
Description-md5: 63097b90fc4b0f93c181ccd92c47b673
Homepage: https://launchpad.net/redshift
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubuntu

Is this on purpose or have I done something wrong?

have multiple brightness settings for different times of day.

Hi all,
I am using redshift 1.7.2 which has only two values for brightness which co-incide with day and night. It would be nice if we had an evening value-pair as well.

This is how it looks at my end :-

$ cat ~/.config/redshift.conf 
; Global settings for redshift
[redshift]
; Set the day and night screen temperatures
temp-day=5700
temp-night=3500

; Enable/Disable a smooth transition between day and night
; 0 will cause a direct change from day to night screen temperature. 
; 1 will gradually increase or decrease the screen temperature
transition=1

; Set the screen brightness. Default is 1.0
;brightness=0.9
; It is also possible to use different settings for day and night since version 1.8.
;brightness-day=0.7
;brightness-night=0.4
; Set the screen gamma (for all colors, or each color channel individually)
gamma=0.8
;gamma=0.8:0.7:0.8

; Set the location-provider: 'geoclue', 'gnome-clock', 'manual'
; type 'redshift -l list' to see possible values
; The location provider settings are in a different section.
location-provider=manual

; Set the adjustment-method: 'randr', 'vidmode'
; type 'redshift -m list' to see all possible values
; 'randr' is the preferred method, 'vidmode' is an older API
; but works in some cases when 'randr' does not.
; The adjustment method settings are in a different section.
adjustment-method=vidmode

; Configuration of the location-provider:
; type 'redshift -l PROVIDER:help' to see the settings
; ex: 'redshift -l manual:help'
 [manual]
 lat=18.5203
 lon=73.8567

; Configuration of the adjustment-method
; type 'redshift -m METHOD:help' to see the settings
; ex: 'redshift -m randr:help'
; In this example, vidmode is configured to adjust screen 1. 
; Note that the numbering starts from 0, so this is actually the second screen.
[vidmode]
screen=0

The above configuration file was stolen from the interweb somewhere. The only changes are/were the latitude and longitude readings and the screen 0 thing.

I did read that there is a difference between randr and vidmode but the configuration file shared didn't document what to do if randr is used. Should it be just :-

[randr]
screen=0

These are my values via xrandr :-

$ xrandr 
Screen 0: minimum 320 x 200, current 1600 x 900, maximum 32767 x 32767
VGA1 connected primary 1600x900+0+0 (normal left inverted right x axis y axis) 443mm x 249mm
1600x900       60.0*+
1400x1050      60.0  
1280x1024      75.0     60.0  
1440x900       59.9  
1280x800       59.8  
1152x864       75.0  
1024x768       75.1     70.1     60.0  
 832x624        74.6  
 800x600        72.2     75.0     60.3     56.2  
 640x480        75.0     72.8     66.7     60.0  
 720x400        70.1  

Looking forward to know more.

Redshift (with geoclue provider) crashes when started outside of an X session

It should not segfault, but error out more gracefully (like with the other providers).

I have tried and reproduced this with redshift master:

  1. Build redshift with geoclue support
  2. Start redshift from outside of an X session
% /tmp/redshift/src/redshift
Trying location provider `geoclue'...

** (process:29265): WARNING **: Unable to get connection to Geoclue bus.
Unable to autolaunch a dbus-daemon without a $DISPLAY for X11

** (process:29265): CRITICAL **: dbus_g_proxy_call: assertion 'DBUS_IS_G_PROXY (proxy)' failed
[1]    29265 segmentation fault  /tmp/redshift/src/redshift

See also https://bugs.launchpad.net/ubuntu/+source/redshift/+bug/888661 for the bug in Launchpad.

Add support for "bedtime" mode

f.lux recently added support for a bedtime mode. It's like a third color temperature setting that's set even lower (default 1900K in f.lux) to help you get to sleep. It takes in the time you wake up in the morning in order to know when to set bedtime mode. It defaults to 9 hours of sleep, with some other settings like "sleep in on weekends" and "extra hour of sleep (ages 13-18)", but I'm not quite sure how those work yet.

This might be a useful thing to see in redshift as well.

http://justgetflux.com/news/pages/mac/ for more details

Color resets/disables when closing certain applications, then re-enables seconds later.

The issue only happens for me when I close Minecraft. When I close it, it's like redshift quits becuse my screen instantly turns from whatever color it is to what color it would have if redshift was not running. After a few seconds, the screen instantly turns back to what color it should be with redshift.

Not sure why this happens, but I've only had it happen when closing Minecraft. Happens every time I close Minecraft.

[1.9] Tray icon click causes backtrace

Traceback (most recent call last):
  File "/usr/lib64/python3.2/site-packages/redshift_gtk/statusicon.py", line 219, in toggle_cb
    if self.is_enabled() != widget.get_active():
AttributeError: 'StatusIcon' object has no attribute 'get_active'

redshift-gtk exits with 255 on Xubuntu 14.04

First off, long time user, first time submitting a bug. I rely on redshift so thank you!

I just installed 1.9.1 on my newly upgraded Xubuntu 14.04 laptop and when I run redshift-gtk the program immediately exits with a 255 error code.

In fact, when I run just

$> redshift -v -l 45.523449:-122.676208
Location: 45.523449, -122.676208
Temperatures: 5500K at day, 3500K at night
Brightness: 1.00:1.00
Gamma: 1.000, 1.000, 1.000
No more methods to try.

the program immediately exits with 1.

If there is any more info I can provide, please let me know.

Does not work on Ubuntu 14.04 with Nvidia Driver

I know there is a problem with Nvidia drivers for Ubuntu. I was using Redshift on Ubuntu 13.10 and it worked ok. I just upgraded to 14.04 and now the redshift will just occur as a flicker every several seconds. I know that f.lux handles the drivers correctly as it seems to work fine after upgrade.

Port to Geoclue2

Development on the original Geoclue has stopped and there is still a ton of issues with it (most importantly random segfaults), so it seems reasonable to move to Geoclue2 as soon as possible as future improvements will happen there. (As an example this bug https://bugs.freedesktop.org/show_bug.cgi?id=39234 basically means that the new dbus-service branch of redshift crashes on every startup; it is marked as WONTFIX).

Geoclue2 has no C library interface so it is necessary to go directly through the DBus interface. It seems that the high-level DBus API in Gio (https://developer.gnome.org/gio/stable/) can be used. I don't know if it is worthwhile to set up gdbus-codegen to generate an interface or if it is easier to just instantiate GDBusProxy objects. As with the old Geoclue code I don't think we can easily get location updates without replacing the core of Redshift with a Glib main loop (also worth considering).

Another consideration is whether Geoclue2 is mature enough. I did a quick test to check that it works (Geoclue2-2.0.0 in Fedora) and it seemed to work although the implementation has to be done carefully. One thing in particular is noteworthy: It appears that the location cannot be read before a LocationUpdated signal is sent. This means that a main loop is needed even for reading the current location, so Geoclue2 support cannot be easily added to the current Redshift implementation.

Python script shouln't modify sys.path

At the top of redshift-gtk we currently have this nice line of code:

/home/jon/Development/jonls/redshift/build/native/../root/lib/python3.3/site-packages

.... which allows any user named 'jon' (with homedir '/home/jon') to insert arbitrary code into the redshift process run by any other user on the system. This is a security breach.

Python scripts should probably not modify sys.path at all.

Fallback location provider

Hi,

I'm often not at home and I'd like to use GeoClue provider to not worry about updating my location when using redshift. But it depends on an internet connection, which may not be available at startup.

I saw in an issue that you are planning to enhance this provider to check periodically for the location. But would it be possible to implement also a fallback mechanism ?

For example, if my internet connection is down and redshift can't get the location from the geoclue provider, then it uses the manual configuration instead, and will use again the location from the geoclue provider when it will be available ?

Thanks

Feature: Add Wayland support

I use a Jolla phone with SailfishOS which already uses Wayland as display server. One thing I'm really missing is color shift in the dark. Is there something similar to the X server extension used for Wayland?

GUI status icon script works in Python 3.2

I have try to build on Ubuntu 12.04 with Python 2.7.3 and this error occurs. Is there a way to build with Python 2.7?

pavel@mintdesktop ~/Downloads/sources/redshift $ ./configure --enable-gui --enable-ubuntu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking for gcc option to accept ISO C99... -std=gnu99
checking whether NLS is requested... yes
checking for msgfmt... /usr/bin/msgfmt
checking for gmsgfmt... /usr/bin/msgfmt
checking for xgettext... /usr/bin/xgettext
checking for msgmerge... /usr/bin/msgmerge
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for ld used by GCC... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for shared library run path origin... done
checking for CFPreferencesCopyAppValue... no
checking for CFLocaleCopyCurrent... no
checking for GNU gettext in libc... yes
checking whether to use NLS... yes
checking where the gettext function comes from... libc
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for DRM... yes
checking for X11... yes
checking for XF86VM... yes
checking for XCB... yes
checking for XCB_RANDR... no
checking for GEOCLUE... no
checking how to run the C preprocessor... gcc -std=gnu99 -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking windows.h usability... no
checking windows.h presence... no
checking for windows.h... no
checking for a Python interpreter with version >= 3.3... none
checking whether to enable DRM method... yes
checking whether to enable RANDR method... missing dependencies
checking whether to enable VidMode method... yes
checking whether to enable WinGDI method... missing dependencies
checking whether to enable Geoclue location provider... missing dependencies
checking whether to enable GUI status icon... missing dependencies
configure: error: GUI status icon script requires Python 2.6

pavel@mintdesktop ~/Downloads/sources/redshift $ python --version
Python 2.7.3
pavel@mintdesktop ~/Downloads/sources/redshift $ python3 --version
Python 3.2.3

Can't compile

There appears to be no configure file but there's a configure.ac file so what I did was to autoconf but I get these errors:

# autoconf
configure.ac:8: error: possibly undefined macro: AM_INIT_AUTOMAKE
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
configure.ac:16: error: possibly undefined macro: AM_GNU_GETTEXT_VERSION
configure.ac:17: error: possibly undefined macro: AM_GNU_GETTEXT
configure.ac:32: error: possibly undefined macro: AM_PATH_PYTHON
configure.ac:56: error: possibly undefined macro: AM_CONDITIONAL

Base gamma adjustment on the gamma ramps at startup

When Redshift starts it simply overrides the current gamma ramps. The former gamma ramps are saved so they can be restored when Redshift exits, but they could also be used as a base for applying the redness adjustment on top. This would presumably allow people who have customized gamma ramps (for color correction or otherwise) to use Redshift on top of that.

Add custom sunrise and sunset times

It would be extremely useful to set a parameter with custom sunrise and sunset times instead of a location.
I live in Estonia, where the sun sets in winter at around 15:00 and in summer around 22:00. I dont want my laptops screen temperature to tell my brain to start preparing for sleep at 15:00. This can be solved with a custom forced sunset time. This new parameter would override the one set with "-l"

flux comparison in readme

i think it would be wise to include a comparison of the benefits of redshift versus flux. just a suggestion.

[RFC] Change transition period.

I think that perhaps the time when full daytime settings and full nighttime settings
kick in should be moved. I find especially that my eyes are not ready for 5500 K
at 3°. I suggest moving the times to −12° and 12°.

Cannot limit to one randr output

Using the example http://jonls.dk/redshift/:

[vidmode]
screen=0

in ~/.config/redshift.conf still applies redshift to my second monitor. I've tried variations of this, but they have no effect. I want to only apply redshift to my first screen. Not that it should make any difference but I use gtk-redshift to launch redshift.

Side note: If I start two instances of redshift then terminate the second, it segfaults.

$ redshift -V
redshift 1.7

Limitation in Windows on mirrored displays

I am not completely sure about this. But I think Windows
does not support gamma ramps on monitors whose output
is mirrored to another display.

For example, if the user has three monitors, and monitor
1 and monitor 2 are mirrors of each other, Windows will
only support gamma ramps on monitor 3. Thus Redshift
will only be able to control the third monitor.

Change temperature from the icon

Thank you for developing redshift!
I'd love to see this feature implemented: changing the current temperature on the fly by hovering the mouse on the gtk icon and moving the scrolling wheel (or dragging a slider maybe).
The action should affect the value of the daytime or nighttime temperature (based on the current time of the day) and save the new value.

Thank you!

[systemd] user service files not functional -- lack "Environment=DISPLAY=:0" (v.1.9.1 Archlinux)

Hi,

First of all thanks for writing and maintaining this program, it is one of the most essential to my daily use of computers. Really, thanks a lot for making it, moreover as libre software.

Recently I stumbled upon the changelog for version 1.9, which mentioned the new systemd service files. As I'm on Archlinux which uses systemd, I thought I'd give it a try so as to rationalise my service management.

However I coudn't get neither redshift-gtk nor redshift to start this way. Two separate problems are involved:

  • The first one is that the redshift-gtk.service file provided by the precompiled Arch package (downloadable here) contains the wrong binary name on the ExecStart line: it refers to /usr/bin/redshift instead of /usr/bin/redshift-gtk; bug report on the distro bugtracker here. May it have something to do with the way --with-systemduserunitdir build option acts?
  • The second error concerns both service files: for them to work on Arch the option Environment=DISPLAY=:0 must be added to the [Service] part of the service files. See this thread on Arch forum for the complete details (journal entries included).

I was wondering how to debug this further, as @hdevalence didn't seem to meet this issue when he made #35.

Thanks

Invert colors

I would like to see an option -i that makes redshift invert all colors before any other operators are applied.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.