Coder Social home page Coder Social logo

spantaleev / redshift-scheduler Goto Github PK

View Code? Open in Web Editor NEW
24.0 5.0 2.0 58 KB

Rule-based screen temperature changer (based on redshift)

License: GNU General Public License v3.0

Shell 0.93% Vala 99.07%
redshift color-temperature eye-strain gamma-ramps night night-mode eye-care screen-brightness

redshift-scheduler's Introduction

Redshift Scheduler

redshift-scheduler, as the name implies is a scheduler program for redshift.

Redshift adjusts the color temperature of your screen according to your surroundings (meaning according to the time of day and your location). This may help your eyes hurt less if you are working in front of the screen at night.

However, not everyone has the same day-schedule and likes their screen "turning red" at ~17:00 in the afternoon.


What does it do?

Read the description over at redshift's page for an introduction to the general idea of "screen temperature changing".

You can then determine whether redshift is good enough for you, or you need the advanced control that redshift-scheduler offers.


What problems with redshift does this fix?

redshift-scheduler addresses the following problems with the way redshift works:

  1. No sane control over the screen temperature over the day

    • redshift uses the time of day and your location to "magically" determine a temperature value (which you might not always like)
    • redshift-scheduler gives you a way configure the exact temperature and temperature transitions at any time of the day
  2. No control over how gradually the temperature changes

    • redshift's temperature transitions are somewhat fast (strikingly visible and thus, annoying)
    • redshift-scheduler's temperature transitions can be very gradual (invisible to the user)

How does it work?

redshift-scheduler uses a configuration file that specifies a number of rules. Rules define time periods within the day and their corresponding temperature (or temperature transition).

Generally, rules state something like this:

  • from 11:00 to 18:00, I'd like the maximum screen temperature (6500K)
  • from 18:00 to 20:00, I'd like a gradual decrease from 6500K to 5000K
  • from 20:00 to 23:30, I'd like a gradual decrease from 5000K to 4500K
  • etc.

To learn more, see the sample/default rules file (in the resources/ directory).

redshift-scheduler calculates the temperature at any given moment of the day and periodically invokes redshift to apply it. Therefore, you need redshift installed as well.


Installation

Packages

A package for ArchLinux is available here. Contributions, so that packages for other distros can be made, are always welcome.

Manual Installation

redshift-scheduler is written in Vala and compiles to native code.

Build from source (requires: vala, glib2 and libgee):

./build.sh

The redshift-scheduler executable would appear in the newly created build/ directory. Copy the redshift-scheduler executable file anywhere you'd like.

Copy the default rules file (resources/rules.conf.dist) to ~/.config/redshift-scheduler/rules.conf.

Copy the desktop file (resources/redshift-scheduler.desktop) to ~/.local/share/applications/. This will allow to add the tool as a startup item using e.g. the GNOME Tweak Tool

Make sure you have redshift installed, as redshift-scheduler depends on it.

For distro packagers

A package would:

  • build the executable and stage it for copying to /usr/bin/ or some other such location
  • stage resources/rules.conf.dist (the default config) for copying to /usr/share/redshift-scheduler/rules.conf.dist
  • stage resources/redshift-scheduler.desktop (the desktop file) for copying to /usr/share/applications/

Dependencies:

  • Vala
  • glib2
  • Libgee
  • the redshift binary on the path

Usage

The program is meant to start and run with user privileges. You can set it up to start on desktop environment start-up (with gnome-session-properties, xfce4-session-settings, etc.)

The first time you can run redshift-scheduler from the command-line. During that first start, ~/config/redshift-scheduler/rules.conf will be created, based on the default configuration at /usr/share/redshift-scheduler/rules.conf.dist.

redshift-scheduler runs during the day and controls the screen temperature according to the rules in ~/config/redshift-scheduler/rules.conf.

Rules can be customized to your liking. Rule changes take effect immediately (without needing a program restart).

Ideas/future developments

  • The ability to temporarily disable temperature changes ("stop for 1 hour", etc.)

  • A GUI tray program that allows certain features of redshift-scheduler to be controlled with the mouse (disabling temporarily, showing the current temperature)

redshift-scheduler's People

Contributors

aperezdc avatar spantaleev 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

Watchers

 avatar  avatar  avatar  avatar  avatar

redshift-scheduler's Issues

Is there a workaround for controlling brightness as well?

Is there a workaround for controlling brightness as well (via redshift -b)? It's the only thing missing. I find that late at night, the screen is too bright unless at the temperature is set incredibly low (~1900K), which makes things too red. Unfortunately, setting redshift's brightness manually seems to conflict with redshift-scheduler--it would set the brightness but reset after a while (perhaps in a minute or so, which I guess is because of redshift-scheduler's gradual change per minute).

Is this still being maintained?

redshift-scheduler is a fork of redshift, right? Last commit was around December 2014, but the latest version of redshift was released around January 2015.

redshift-scheduler and redshift show different temperatures

I'm using the info-redshift-temp script for polybar, which essentially uses the redshift -p command to get the current temperature.

The temperatures shown by this script are not the same as the temperatures shown by the debug-mode redshift-scheduler -d . The temps I'm getting form redshift -p are always higher and mostly stuck at a fixed value (e.g. 4500k) for half an hour even though redshift-scheduler seams to work correctly.

First question: Why does redshift print a different (wrong) temperature?

Second question: Is there an easy way to print the current temperature with redshift-scheduler so it can be used in a polybar-modul?


Thanks for considering and the great work so far!

Segfault when installed incorrectly (missing config file)

I've tried to run the program without copying the config file, and it crashed, dumping a core:

% ./build.sh
% build/redshift-scheduler 
[error] Could not create default rules file. The program is most likely installed incorrectly.
[1]    13760 trace trap (core dumped)  build/redshift-scheduler

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.