mirror of
https://github.com/vincentbernat/i3wm-configuration.git
synced 2025-06-22 09:53:28 +02:00
xrandr: don't poll hardware when it's not needed
This commit is contained in:
parent
95dd95e4ce
commit
08fa9a63d0
2 changed files with 2 additions and 2 deletions
|
@ -3,7 +3,7 @@
|
||||||
DISPLAY=${DISPLAY%.0}
|
DISPLAY=${DISPLAY%.0}
|
||||||
|
|
||||||
# For information
|
# For information
|
||||||
xrandr \
|
xrandr --current \
|
||||||
| sed -n 's/^\([^ ]\)* connected.* \([0-9]*\)x.* \([0-9]*\)mm x .*/\1 \2 \3/p' \
|
| sed -n 's/^\([^ ]\)* connected.* \([0-9]*\)x.* \([0-9]*\)mm x .*/\1 \2 \3/p' \
|
||||||
| while read output pixels mm; do
|
| while read output pixels mm; do
|
||||||
dpi=$(($pixels * 25.4 / $mm))
|
dpi=$(($pixels * 25.4 / $mm))
|
||||||
|
|
|
@ -24,7 +24,7 @@ case "$1" in
|
||||||
trap "systemctl --user kill -s CONT redshift@$(systemd-escape -- "$DISPLAY").service" EXIT
|
trap "systemctl --user kill -s CONT redshift@$(systemd-escape -- "$DISPLAY").service" EXIT
|
||||||
trap 'echo notify: user activity; kill %% 2> /dev/null; exit 0' HUP # user activity
|
trap 'echo notify: user activity; kill %% 2> /dev/null; exit 0' HUP # user activity
|
||||||
trap 'echo notify: locker started; kill %% 2> /dev/null; exit 0' TERM # locker started
|
trap 'echo notify: locker started; kill %% 2> /dev/null; exit 0' TERM # locker started
|
||||||
outputs=($(xrandr -q | sed -n 's/\([^ ]*\) connected .*/\1/p'))
|
outputs=($(xrandr --current | sed -n 's/\([^ ]*\) connected .*/\1/p'))
|
||||||
for out in ${outputs[@]}; do
|
for out in ${outputs[@]}; do
|
||||||
xrandr --output $out --brightness 0.2
|
xrandr --output $out --brightness 0.2
|
||||||
done
|
done
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue