My configuration files for Debian/Ubuntu applications
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

redshift.md 3.5 KiB

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