June 15, 2014 · bash blue debian display hacks linux night productivity screen timemanagment tricks xorg xrandr

More of xrandr or blue light exposure

Recently I come across a website that claims blue light affects your sleep. This is especially useful when you work on your computer late at night and are exposed to unnatural for the time of the day light. Once you decrease the "sun" light during late hours you should feel more tired before going to bed.

There are several ways to reduce the blue light effect on your PC screen. One of them would be to install the f.lux application that automatically adjust sour screen settings. However, if you don't really like to install a separate application for this purpose, here's a simple script to achieve the desired effect.

#!/bin/sh 

night_mode() { 
  for disp in $(xrandr | sed -n 's/^\([^ ]*\).*\<connected>.*/\1/p'); do 
    xrandr --output $disp --gamma $1 --brightness $2 
  done } 
case $1 in 
  off) night_mode 1:1:1 1.0 ;; 
  *) night_mode 1:1:0.5 0.7 ;;
esac

The script reduces blue light component and brightness of all Xorg displays attached. Simply save it in your bin directory, chmod +x it and, if you want to, add a cron job or keyboard shortcut to call the function.

How it works? Simply type in the script name without any parameters to reduce blue light. To return to normal setting, add off parameter after the command.

  • LinkedIn
  • Tumblr
  • Reddit
  • Google+
  • Pinterest
  • Pocket

Contact