1 ### What is Redshift? #
3 [**Project homepage**](http://jonls.dk/redshift/)
5 >**Redshift** is an application that adjusts the computer display's color temperature based upon the Sun's apparent position in relation to the user's location on Earth.
7 >The program is free software, inspired by the proprietary f.lux, and can be used to reduce eye strain as well as insomnia and delayed sleep phase syndrome.
9 >The computer display's color temperature transitions evenly from night to daytime temperature to allow the user's eyes to slowly adapt. At night, the color temperature is low and is typically 3000–4000 K (default is 3500 K), preferably matching the room's lighting temperature. Typical color temperature during the daytime is 5500–6500 K (default is 5500 K).
11 **Source:** [Wikipedia](https://en.wikipedia.org/wiki/Redshift_%28software%29)
15 **Redshift must be installed** on your system if you want to use this widget.
17 Packages should be available for most distributions. Source code and build instructions can be found on Github [here](https://github.com/jonls/redshift).
19 You also need a valid config file. Please see the [project homepage](http://jonls.dk/redshift/) for details. An example: [`~/.config/redshift.conf`](https://github.com/jonls/redshift/blob/master/redshift.conf.sample).
21 You have to match the location settings to your personal situation: you can adjust the `lat` and `lon` variables using a [web service](https://encrypted.google.com/search?q=get+latitude+and+longitude).
23 You might also want to modify the color temperatures to fit your preferences.
27 This widget provides the following functions:
29 | function | meaning |
31 | `redshift:toggle()` | Toggles Redshift adjustments on or off, and also restarts it if terminates. |
32 | `redshift:attach(widget, update_function)` | Attach to a widget. Click on the widget to toggle redshift on or off. `update_function` is a callback function which will be triggered each time Redshift changes its status. (See the examples below.) |
36 #### Textbox status widget
39 myredshift = wibox.widget.textbox()
40 lain.widget.contrib.redshift:attach(
44 myredshift:set_text("RS on")
46 myredshift:set_text("RS off")
52 Then add `myredshift.widget` to your wibox.
54 #### Checkbox status widget
57 local markup = lain.util.markup
59 local myredshift = wibox.widget{
61 check_color = "#EB8F8F",
62 border_color = "#EB8F8F",
64 shape = gears.shape.square,
65 widget = wibox.widget.checkbox
68 local myredshift_text = wibox.widget{
70 widget = wibox.widget.textbox,
73 local myredshift_stack = wibox.widget{
76 layout = wibox.layout.stack
79 lain.widget.contrib.redshift:attach(
83 myredshift_text:set_markup(markup(beautiful.bg_normal, "<b>R</b>"))
85 myredshift_text:set_markup(markup(beautiful.fg_normal, "R"))
87 myredshift.checked = active
92 Then add the `myredshift_stack` widget to your wibox.
96 Add this to the keybindings in your `rc.lua`:
98 -- Toggle redshift with Mod+Shift+t
99 awful.key({ modkey, "Shift" }, "t", function () lain.widget.contrib.redshift:toggle() end),