mirror of
https://github.com/vincentbernat/i3wm-configuration.git
synced 2025-06-24 18:58:33 +02:00
xss-lock: revert previous commit but keep systemd changes
This commit is contained in:
parent
340f063b4e
commit
c2128a109d
1 changed files with 7 additions and 10 deletions
17
bin/xss-lock
17
bin/xss-lock
|
@ -24,19 +24,16 @@ case "$1" in
|
||||||
--property MainPID \
|
--property MainPID \
|
||||||
--value redshift@$(systemd-escape -- "$DISPLAY").service)
|
--value redshift@$(systemd-escape -- "$DISPLAY").service)
|
||||||
[ x$redshift = x ] || kill -STOP $redshift
|
[ x$redshift = x ] || kill -STOP $redshift
|
||||||
current=$(xrandr --verbose | sed -n \
|
trap "[ x$redshift = x ] || kill -CONT $redshift" EXIT
|
||||||
-e 's/\([^ ]*\) connected .*/--output \1/p' \
|
|
||||||
-e 's/\t*Gamma: *\([^ ]\)/--gamma \1/p' \
|
|
||||||
-e 's/\t*Brightness: *\([^ ]\)/--brightness \1/p' | \
|
|
||||||
tr '\n' ' ')
|
|
||||||
trap "echo notify: restore brightness;
|
|
||||||
xrandr $current;
|
|
||||||
[ x$redshift = x ] || kill -CONT $redshift" EXIT
|
|
||||||
trap 'kill %% 2> /dev/null; exit 0' HUP # user activity
|
trap 'kill %% 2> /dev/null; exit 0' HUP # user activity
|
||||||
trap 'sleep 0.2s; kill %% 2> /dev/null; exit 0' TERM # locker started
|
trap 'sleep 0.2s; kill %% 2> /dev/null; exit 0' TERM # locker started
|
||||||
|
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
|
||||||
xrandr $(echo $current | sed "s/\(--brightness\) [^ ]*/\1 $i/g")
|
for out in ${outputs[@]}; do
|
||||||
sleep 0.05
|
xrandr --output $out --brightness $i || \
|
||||||
|
outputs=("${outputs[@]/$out}")
|
||||||
|
done
|
||||||
|
sleep 0.1
|
||||||
done
|
done
|
||||||
echo "notify: end"
|
echo "notify: end"
|
||||||
sleep infinity &
|
sleep infinity &
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue