Configuring redshift

This commit is contained in:
Dan Buch 2017-12-15 21:56:55 -05:00
parent 4cfc692186
commit 1948ab154b
Signed by: meatballhat
GPG Key ID: 9685130D8B763EA7
3 changed files with 43 additions and 5 deletions

View File

@ -1,13 +1,19 @@
SOURCES := $(shell ls | grep -E -v 'README|Makefile')
TARGETS := $(patsubst %,$(HOME)/.%,$(SOURCES))
TOP_SOURCES := $(git ls-files | grep -vE 'README|Makefile|^config|^\.git|^\.travis' | grep -v /)
CONFIG_SOURCES := $(shell git ls-files config)
TARGETS := \
$(patsubst %,$(HOME)/.%,$(TOP_SOURCES)) \
$(patsubst %,$(HOME)/.%,$(CONFIG_SOURCES))
$(HOME)/.%: %
$(RM) '$@' && ln -svf '$(PWD)/$^' '$@'
$(RM) '$@' && mkdir -p $(dir $@) && ln -svf '$(PWD)/$^' '$@'
.PHONY: all
all: $(TARGETS)
all: $(HOME)/.config $(TARGETS)
$(HOME)/.config:
mkdir -p $@
.PHONY: echo
echo:
@echo SOURCES=$(SOURCES)
@echo TOP_SOURCES=$(TOP_SOURCES)
@echo TARGETS=$(TARGETS)

6
config/redshift.conf Normal file
View File

@ -0,0 +1,6 @@
[redshift]
temp-day=6500
temp-night=3000
transition=1
brightness-day=1.0
brightness-night=0.8

View File

@ -0,0 +1,26 @@
#!/bin/sh
main() {
: "${BRIGHTNESS_DAY:=100}"
: "${BRIGHTNESS_TRANSITION:=50}"
: "${BRIGHTNESS_NIGHT:=20}"
: "${FADE_TIME:=60000}"
if [[ "${1}" != period-changed ]]; then
return
fi
case "${3}" in
night)
xbacklight -set "${BRIGHTNESS_NIGHT}" -time "${FADE_TIME}"
;;
transition)
xbacklight -set "${BRIGHTNESS_TRANSITION}" -time "${FADE_TIME}"
;;
daytime)
xbacklight -set "${BRIGHTNESS_DAY}" -time "${FADE_TIME}"
;;
esac
}
main "$@"