xsettingsd: don't use a subshell when computing DPI

This is to be able to use `dpi` variable. Also, for some reason, the
journal doesn't keep the output of short-lived processes.
This commit is contained in:
Vincent Bernat 2020-01-31 07:14:28 +01:00
parent 139af6fed5
commit 498606b38e

View file

@ -3,9 +3,12 @@
DISPLAY=${DISPLAY%.0}
# For information
xrandr --current \
| sed -n 's/^\([^ ]\{1,\}\)* connected.* \([0-9]\{1,\}\)x.* \([0-9]\{1,\}\)mm x .*/\1 \2 \3/p' \
| while read output pixels mm; do
for info in $(xrandr --current \
| sed -n 's/^\([^ ]\{1,\}\)* connected.* \([0-9]\{1,\}\)x.* \([0-9]\{1,\}\)mm x .*/\1,\2,\3/p'); do
output=${info%%,*}
pixels=${info#*,}
pixels=${pixels%%,*}
mm=${info##*,}
dpi=$(($pixels * 254 / 10 / $mm))
# For laptop screens, we need to apply a correction factor
case $output in