2014-09-17 10:39:22 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
2015-07-23 13:23:09 +02:00
|
|
|
# Compute DPI. We extract the value from xrandr output. The screen
|
|
|
|
# size is correctly reported (while the X server is lying to respect
|
|
|
|
# the provided DPI). We round to the nearest quarter of 96 DPI (96,
|
|
|
|
# 120, 144, 168, 192...).
|
|
|
|
eval $(xrandr --current | sed -n 's/.* connected primary \([0-9]*\)x.* \([0-9]*\)mm x .*/wd=\1\nwm=\2/p')
|
|
|
|
if [ -n "$wd" -a -n "$wm" ]; then
|
|
|
|
dpi=$(echo "$wd/($wm*0.03937)" | bc)
|
|
|
|
dpi=$(printf "%.0f" $(echo "scale=1;$dpi*4/96" | bc))
|
|
|
|
dpi=$((dpi*96/4))
|
2015-07-23 09:02:08 +02:00
|
|
|
else
|
2015-07-23 13:23:09 +02:00
|
|
|
dpi=96
|
2015-07-23 09:02:08 +02:00
|
|
|
fi
|
2015-07-23 13:23:09 +02:00
|
|
|
|
|
|
|
# Build xsettingsd.local
|
|
|
|
cp ~/.config/awesome/xsettingsd ~/.config/awesome/xsettingsd.local
|
2014-11-05 13:40:31 +01:00
|
|
|
echo Xft/DPI $(( $dpi * 1024 )) >> ~/.config/awesome/xsettingsd.local
|
2014-09-17 10:39:22 +02:00
|
|
|
|
|
|
|
# Signal xsettingsd
|
|
|
|
pid=$(xprop -name xsettingsd _NET_WM_PID 2> /dev/null | awk '{print $NF}')
|
2014-09-17 18:02:03 +02:00
|
|
|
if [ x"$pid" = x ]; then
|
2014-09-17 10:39:22 +02:00
|
|
|
xsettingsd -c ~/.config/awesome/xsettingsd.local &
|
2014-09-17 18:02:03 +02:00
|
|
|
else
|
|
|
|
kill -HUP $pid
|
2014-09-17 10:39:22 +02:00
|
|
|
fi
|
2014-11-05 13:40:31 +01:00
|
|
|
|
|
|
|
# Also use xrdb for very old stuff (you know, LibreOffice)
|
|
|
|
echo Xft.dpi: $dpi | xrdb -merge
|