Actualizacion maquina principal
[dotfiles/.git] / .config / awesome / lain / wiki / redshift.md
1 ### What is Redshift? #
2
3 [**Project homepage**](http://jonls.dk/redshift/)
4
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.
6 >
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.
8 >
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).
10
11 **Source:** [Wikipedia](https://en.wikipedia.org/wiki/Redshift_%28software%29)
12
13 ### Preparations
14
15 **Redshift must be installed** on your system if you want to use this widget.
16
17 Packages should be available for most distributions. Source code and build instructions can be found on Github [here](https://github.com/jonls/redshift).
18
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).
20
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).
22
23 You might also want to modify the color temperatures to fit your preferences.
24
25 ### Using the widget
26
27 This widget provides the following functions:
28
29 | function | meaning |
30 | --- | --- |
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.) |
33
34 ### Usage examples
35
36 #### Textbox status widget
37
38 ```lua
39 myredshift = wibox.widget.textbox()
40 lain.widget.contrib.redshift:attach(
41     myredshift,
42     function (active)
43         if active then
44             myredshift:set_text("RS on")
45         else
46             myredshift:set_text("RS off")
47         end
48     end
49 )
50 ```
51
52 Then add `myredshift.widget` to your wibox.
53
54 #### Checkbox status widget
55
56 ```lua
57 local markup = lain.util.markup
58
59 local myredshift = wibox.widget{
60     checked      = false,
61     check_color  = "#EB8F8F",
62     border_color = "#EB8F8F",
63     border_width = 1,
64     shape        = gears.shape.square,
65     widget       = wibox.widget.checkbox
66 }
67
68 local myredshift_text = wibox.widget{
69     align  = "center",
70     widget = wibox.widget.textbox,
71 }
72
73 local myredshift_stack = wibox.widget{
74     myredshift,
75     myredshift_text,
76     layout = wibox.layout.stack
77 }
78
79 lain.widget.contrib.redshift:attach(
80     myredshift,
81     function (active)
82         if active then
83             myredshift_text:set_markup(markup(beautiful.bg_normal, "<b>R</b>"))
84         else
85             myredshift_text:set_markup(markup(beautiful.fg_normal, "R"))
86         end
87         myredshift.checked = active
88     end
89 )
90 ```
91
92 Then add the `myredshift_stack` widget to your wibox.
93
94 #### Keybinding
95
96 Add this to the keybindings in your `rc.lua`:
97 ```lua
98 -- Toggle redshift with Mod+Shift+t
99 awful.key({ modkey, "Shift" }, "t", function () lain.widget.contrib.redshift:toggle() end),
100 ```