mirror of
https://github.com/vincentbernat/i3wm-configuration.git
synced 2025-08-07 11:44:48 +02:00
xss-lock: restore gamma/brightness on exit
redshift may take some time to restore it.
This commit is contained in:
parent
864fd73bf9
commit
feb4ae0793
1 changed files with 8 additions and 3 deletions
11
bin/xss-lock
11
bin/xss-lock
|
@ -21,9 +21,14 @@ case "$1" in
|
||||||
dim|notify)
|
dim|notify)
|
||||||
echo "notify: start"
|
echo "notify: start"
|
||||||
pkill -STOP redshift
|
pkill -STOP redshift
|
||||||
trap 'pkill -CONT redshift' EXIT
|
current=$(xrandr --verbose | sed -n \
|
||||||
trap 'kill %% 2> /dev/null; exit 0' HUP
|
-e 's/\([^ ]*\) connected .*/--output \1/p' \
|
||||||
trap 'sleep 1s; kill %% 2> /dev/null; exit 0' TERM
|
-e 's/\t*Gamma: *\([^ ]\)/--gamma \1/p' \
|
||||||
|
-e 's/\t*Brightness: *\([^ ]\)/--brightness \1/p' | \
|
||||||
|
tr '\n' ' ')
|
||||||
|
trap "echo resume redshift; xrandr $current; pkill -CONT redshift" EXIT
|
||||||
|
trap 'kill %% 2> /dev/null; exit 0' HUP # user activity
|
||||||
|
trap 'sleep 0.2s; kill %% 2> /dev/null; exit 0' TERM # locker started
|
||||||
outputs=($(xrandr -q | sed -n 's/\([^ ]*\) connected .*/\1/p'))
|
outputs=($(xrandr -q | sed -n 's/\([^ ]*\) connected .*/\1/p'))
|
||||||
for i in $(seq 0.7 -0.01 0.1); do
|
for i in $(seq 0.7 -0.01 0.1); do
|
||||||
for out in ${outputs[@]}; do
|
for out in ${outputs[@]}; do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue