#!/bin/bash # redshift-adjust — Script for manually adjusting the colour temperature with hotkeys # Copyright © 2014, 2015 Mattias Andrée (maandree@member.fsf.org) # Copyright © 2015 "tPenguinLTG" # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . file="/tmp/.${UID}.${DISPLAY}.redshift-adjust" if [ ! $# = 1 ] || [ "${1}" = "-h" ] || [ "${1}" = "--help" ]; then cat < "${file}" fi if [ "${1}" = "-p" ] || [ "${1}" = "--print" ]; then cat "${file}" exit 0 fi if [ "${1::1}" = "=" ]; then temperature="${1:1}" else temperature=$(( $(cat "${file}") ${1::1} ${1:1} )) fi redshift -P -O $temperature || redshift -O $temperature echo $temperature > "${file}"