mirror of
https://github.com/vincentbernat/i3wm-configuration.git
synced 2025-08-31 06:59:28 +02:00
xsettingsd: use first screen DPI as DPI for the session
This commit is contained in:
parent
498606b38e
commit
9eab93570d
1 changed files with 6 additions and 9 deletions
|
@ -2,7 +2,8 @@
|
|||
|
||||
DISPLAY=${DISPLAY%.0}
|
||||
|
||||
# For information
|
||||
# Compute DPI of each screens
|
||||
dpis=""
|
||||
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%%,*}
|
||||
|
@ -19,17 +20,13 @@ for info in $(xrandr --current \
|
|||
rounded=$(((corrected + 24) / 48 * 48))
|
||||
[ $rounded -gt 192 ] && rounded=$(((corrected + 48) / 96 * 96))
|
||||
[ $rounded -lt 96 ] && rounded=96
|
||||
dpis="$dpis$rounded "
|
||||
echo "$output: ${dpi}dpi (corrected to ${corrected}dpi, rounded to ${rounded}dpi)" >&2
|
||||
done
|
||||
|
||||
# Don't try to guess DPI. For a laptop, we don't want the same DPI as
|
||||
# for an external screen or for a TV. Just hardcode stuff...
|
||||
case $(hostname),$(autorandr --current) in
|
||||
zoro,default) dpi=144 ;;
|
||||
guybrush,default) dpi=144 ;;
|
||||
neo,*) dpi=192 ;;
|
||||
*,*) dpi=96 ;;
|
||||
esac
|
||||
# Use first screen DPI
|
||||
dpi=${dpis## *}
|
||||
dpi=${dpi:-96}
|
||||
|
||||
echo "using ${dpi}dpi" >&2
|
||||
xrandr --dpi $dpi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue